Count unique/distinct items in filtered column

dragonmouse

Board Regular
Joined
May 14, 2008
Messages
129
Office Version
  1. 2016
Platform
  1. Windows
I'm going to do my best to explain:

I have several colums with various pieces of equipment, serials and years. I may filter on one column, then I want to count the number of unique pieces of equipment left...Ultimately I may filter differently.

Example:
A B C
YEAR SERIAL Equipment
2010 123 Toaster
2011 256 Refridgerator
2010 175 Oven
2009 123 Toaster
2012 123 Refridgerator
2010 123 Toaster
2012 116 Toaster


For this example I will filter everything in "2010" and it will return: I want to see this

A B C
YEAR SERIAL Equipment
2010 123 Toaster
2010 175 Oven
2010 123 Toaster

When I run a "COUNT" of unique serials I want it to return a total of:

A B C
YEAR SERIAL Equipment
2010 123 Toaster
2010 175 Oven
2010 123 Toaster
Total 2

I don't want it to count any serials that have been "filtered out" and I don't want it to count "duplicate" serial numbers in the filtered return.

Any ideas? I hope I explained it well enough
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I'm going to do my best to explain:

I have several colums with various pieces of equipment, serials and years. I may filter on one column, then I want to count the number of unique pieces of equipment left...Ultimately I may filter differently.

Example:
A B C
YEAR SERIAL Equipment
2010 123 Toaster
2011 256 Refridgerator
2010 175 Oven
2009 123 Toaster
2012 123 Refridgerator
2010 123 Toaster
2012 116 Toaster


For this example I will filter everything in "2010" and it will return: I want to see this

A B C
YEAR SERIAL Equipment
2010 123 Toaster
2010 175 Oven
2010 123 Toaster

When I run a "COUNT" of unique serials I want it to return a total of:

A B C
YEAR SERIAL Equipment
2010 123 Toaster
2010 175 Oven
2010 123 Toaster
Total 2

I don't want it to count any serials that have been "filtered out" and I don't want it to count "duplicate" serial numbers in the filtered return.

Any ideas? I hope I explained it well enough


Excel 2010
ABCDEF
1YEARSERIALEquipment2
22010123Toaster
42010175Oven
72010123Toaster
Sheet4
Cell Formulas
RangeFormula
F1{=COUNT(1/FREQUENCY(IF(SUBTOTAL(3,OFFSET(A2,ROW(B2:B20)-ROW(A2),)),MATCH(B2:B20,B2:B20,0)),ROW(B2:B20)-ROW(A2)))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
No...not a PIVOT table. There's a lot more data. I just want to total it at the bottom. This did not work unfortunately.
 
Upvote 0
I'm not sure I understand the "A2" in the (A2,ROW(B2:B20) I might be doing that part wrong. It came out with a total of ZERO.

It seems like I used somethign to the effect of =COUNT(Sumproduct(B2:b5, b2:b5) But for the life of me I can't remember the exact forumla.
 
Upvote 0
I dug this up...and it works for "FILTERED" items returning a count...but it doesn't eliminate the DUPLICATES. (if I have two items with the same serial number in the "filtered year" 2010 I only want to count one)

"=SUBTOTAL(3,B6:B13547)"

I've been trying the formula mentioned in an earlier post but I'm doing something horribly wrong.
 
Upvote 0

Forum statistics

Threads
1,214,965
Messages
6,122,499
Members
449,089
Latest member
Raviguru

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
Back
Top