Count Formula

chrysti

Board Regular
Joined
Dec 20, 2006
Messages
218
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
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

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
218
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
218

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,216
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,216

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,216
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 {}.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,741
Messages
5,833,426
Members
430,207
Latest member
MedicineVan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top