Count Formula

chrysti

Board Regular
Joined
Dec 20, 2006
Messages
215
I am using a sumproduct (without the range to sum) to count a list of information that I have, but the issue that I am having is that because this list has everything that we carry and who we have sold it to, things appear in the list more than once. I only want to know how many different items we sold, not how many times we sold that item...is there anyway to get the formula to count only the first time that it encounters a style on the list? They all have different names so it is hard to say only count this, because I am wanting to do it for hundreds of different styles and thousands of sales.

Thanks in advace for the help
Chrysti
 

Some videos you may like

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
hi Chrysti

You didn't indicate how your data is structured, but here is one way - it counts the number of unique courses in the B column:
Excel Workbook
ABCDE
1EmployeeCourse TakenDate
2RichardBaking01-Jan
3BobArchery16-Jan
4SallyArchery31-Jan
5SarahBaking15-Feb
6ChrisFootball02-Mar
7MarkBaking17-MarUnique courses
8TimRugby01-Apr5
9TedBaking16-Apr
10HelenYoga01-May
11RondaArchery16-May
Sheet1
Excel 2002
Cell Formulas
RangeFormula
E8=SUMPRODUCT((B2:B11<>"")/COUNTIF(B2:B11,B2:B11&""))
 

chrysti

Board Regular
Joined
Dec 20, 2006
Messages
215
This is exactly what I need except there would be a tweak, I need to do it by customer type so I would need to add something to filter column a as well, like all the classes that Sarah and Mike are taking that are new...can this be done???

Thanks so much for the quick reply
Chrysti
 

chrysti

Board Regular
Joined
Dec 20, 2006
Messages
215

ADVERTISEMENT

Lets say I want to know how many unique classes the girls are taking and how many unique classes the boys are taking based on the names in column A I would classify in a seperate column for ease boy/girl and then count.

Can this be done???

Thanks so much!!!
 

mgirvin

Well-known Member
Joined
Dec 15, 2005
Messages
1,213
If it is unique count for just Sarah and Richard, then do you want to ask the logical question "if there is at least one "Sarah" in the column, then give me a count of 1?", and the same question for Richard? If so this might work:
Excel Workbook
ABCDE
1EmployeeCourse TakenDate
2RichardBaking1-Jan
3BobArchery16-Jan
4SallyArchery31-Jan
5SarahBaking15-Feb
6ChrisFootball2-Mar
7RichardBaking17-MarUnique courses
8BobRugby1-Apr2
9SallyBaking16-Apr
10SarahYoga1-May
11SarahArchery16-May
Sheet1
Excel 2010
Cell Formulas
RangeFormula
E8=SUMPRODUCT((A2:A11<>"")*((A2:A11="Sarah")+(A2:A11="Richard"))/COUNTIF(A2:A11,A2:A11&""))
 

mgirvin

Well-known Member
Joined
Dec 15, 2005
Messages
1,213

ADVERTISEMENT

Or if the goal is to just see if Sarah Or Richard are listed just once, then maybe this would work:

=(COUNTIF(A2:A11,"Sarah")>0)+(COUNTIF(A2:A11,"Richard")>0)
 

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
Chrysti

It would almost certainly help us to understand what you want to achieve if you could upload a sample of your data (remove any and all confidential information beforehand or use dummy data) and indicate the results you want to achieve from this sample and how you determine those results.

One of the easiest ways of doing this is simply to select your data in Excel (eg select A1:G40) and do an Edit>Copy and then go into your reply in your browser and do a ctrl+v to paste it in. other alternatives would include using the html maker add in which both Mike and I used in some of our replies above to do the same - if you want to go this route, please could you drop me a PM with your email address and I will send it to you :)
 

mgirvin

Well-known Member
Joined
Dec 15, 2005
Messages
1,213
Try this for the "Unique Count of Classes for Boys" and "Unique Count of Classes for Girls":
Excel Workbook
ABCDEF
1EmployeeCourse TakenDateBoy?Girl
2RichardBaking1-JanBoy
3BobArchery16-JanBoy
4SallyArchery31-JanGirl
5SarahBaking15-FebGirlUnique courses For Girls
6ChrisFootball2-MarBoy3
7RichardBaking17-MarBoyUnique courses For Boys
8BobRugby1-AprBoy4
9SallyBaking16-AprGirl
10SarahYoga1-MayGirl
11SarahArchery16-MayGirl
Sheet1
Excel 2010
#VALUE!
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,605
Messages
5,512,379
Members
408,889
Latest member
2vbr

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top