Count if unique

Jak7217

New Member
Joined
Jan 11, 2019
Messages
31
Office Version
  1. 365
Platform
  1. Windows
I started off by making a formula to count unique values in column B, below.

=counta(unique(B:B))

After that, I want to make the formula more elaborate. I only want to count the unique values in column B if column A = "05". I also have a second formula where I want to count unique values in column B when column A = "05", and column F = "5".

Any help would be appreciated. I can write formulas to count unique or countifs for the 5 and 05 criteria, but I can't seem to successfully merge the two.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

How about
Excel Formula:
=ROWS(UNIQUE(FILTER(B2:B10000,A2:A10000="05")))
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

How about
Excel Formula:
=ROWS(UNIQUE(FILTER(B2:B10000,A2:A10000="05")))
Thank you for the quick response, I have updated my account details. I tried your formula, but am having issues with the filter function, it is not found. The only filter function available to me is FILTERXML
 
Upvote 0
If you are using xl 2016 how come you posted this formula
Excel Formula:
=counta(unique(B:B))
as you don't have the Unique function.
 
Upvote 0
I got myself turned around, I'm sorry. I've been researching how to get this to work and tried various formulas. I accidentally posted one of the formulas that I was trying to get to work.
 
Upvote 0
In that case can you post a sample of your data.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
Hey Fluff:

I have restrictions on download and install rights on my PC, I can't use the add-in you are referring to.

Below is an example of the current formula I am using, but still does not fully work.

I want to count unique values in column C if A = 05.

=SUM(IF("05"=A1:A15,1/(COUNTIFS(A1:A15,"05",C1:C15,C1:C15)),0))

Once I figure out how to fix the formula above, I also want to expand it so that it will only count unique if A = 05 and F = 6.

=SUM(IF("05"=A1:A15,1/(COUNTIFS(A1:A15,"05",F1:F15,"6",C1:C15,C1:C15)),0))
 
Upvote 0
In that case can you please just copy & paste some sample data.
 
Upvote 0
Sure - so I want a unique count of column C when column A is equal to 05. I would expect to have a count of 5 because every text other than Foxtrot meets the criteria. Then I want to write an additional formula to count unique for column C when A is equal to 05 and F is equal to 6. I would expect a count of 4 because Echo and Foxtrot don't meet the criteria.

05Alpha6
05Alpha6
05Bravo6
05Bravo5
05Bravo5
05Charlie5
03Charlie6
05Charlie6
05Delta5
05Delta6
05Echo6
05Echo5
05Echo5
05Echo7
02Foxtrot7
 
Upvote 0
Thanks for that, how about
Fluff.xlsm
ABCDEFGH
1
205Alpha65
305Alpha64
405Bravo6
505Bravo5
605Bravo5
705Charlie5
803Charlie6
905Charlie6
1005Delta5
1105Delta6
1205Echo5
1305Echo5
1405Echo5
1505Echo7
1602Foxtrot7
17
Data
Cell Formulas
RangeFormula
H2H2=SUM(--(FREQUENCY(IF(A2:A16="05",MATCH(C2:C16,C2:C16,0)),ROW(C2:C16)-ROW(C2)+1)>0))
H3H3=SUM(--(FREQUENCY(IF((A2:A16="05")*(F2:F16=6),MATCH(C2:C16,C2:C16,0)),ROW(C2:C16)-ROW(C2)+1)>0))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,632
Messages
6,125,913
Members
449,274
Latest member
mrcsbenson

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