Count Unique Values in Range with 3 Criteria

randolphoralph

Board Regular
Joined
Dec 24, 2008
Messages
126
I am trying to use the formula below to count unique values in a range.

=SUM(IF(FREQUENCY(MATCH(Data!Q2:Q434289,Data!Q2:Q434289,0),MATCH(Data!Q2:Q434289,Data!Q2:Q434289,0))>0,1))

The problem I am having is that I need to count the unique values in the range only when the follow is true.

Data!$A$2:$A$434289=$A3

Data!$F$2:$F$434289=$A$1

Data!$H$2:$H$434289=$B$1

I have tried to add this into the formula and can not seem to get it to work.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
I am trying to use the formula below to count unique values in a range.

=SUM(IF(FREQUENCY(MATCH(Data!Q2:Q434289,Data!Q2:Q434289,0),MATCH(Data!Q2:Q434289,Data!Q2:Q434289,0))>0,1))

The problem I am having is that I need to count the unique values in the range only when the follow is true.

Data!$A$2:$A$434289=$A3

Data!$F$2:$F$434289=$A$1

Data!$H$2:$H$434289=$B$1

I have tried to add this into the formula and can not seem to get it to work.
This will take "forever" to calculate.

=SUM(IF(FREQUENCY(IF(Data!$A$2:$A$434289=$A3,IF(Data!$F$2:$F$434289=$A$1,IF(Data!$H$2:$H$434289=$B$1,MATCH(Data!Q2:Q434289,Data!Q2:Q434289,0)))),ROW(Data!Q2:Q434289)-ROW(Data!Q2)+1),1))
 
Upvote 0
This will take "forever" to calculate.

=SUM(IF(FREQUENCY(IF(Data!$A$2:$A$434289=$A3,IF(Data!$F$2:$F$434289=$A$1,IF(Data!$H$2:$H$434289=$B$1,MATCH(Data!Q2:Q434289,Data!Q2:Q434289,0)))),ROW(Data!Q2:Q434289)-ROW(Data!Q2)+1),1))
That's array entered.
 
Upvote 0
Try :

Code:
=SUMPRODUCT(($A$2:$A$434289=$A3)*($F$2:$F$434289)*($H$2:$H$434289))

Success
 
Upvote 0
Biff...you were not kidding about the formula taking "forever" to calculate. I have about 200 cells on 3 sheets that I need to use this formula on. I am thinking that this may not be the best solution.
 
Upvote 0
Biff...you were not kidding about the formula taking "forever" to calculate. I have about 200 cells on 3 sheets that I need to use this formula on. I am thinking that this may not be the best solution.
That's a lot of rows of data and with several conditions = good luck! :eeek:

Excel sorely needs a built-in function for counting uniques.
 
Upvote 0
Well here is my solution....copy the data to a new sheet. Delete only the values I want to count and the criteria I want to look at. Then remove duplicates. Then use SUMPRODUCT to count the values with the duplicates removed. :biggrin:
 
Upvote 0

Forum statistics

Threads
1,224,507
Messages
6,179,183
Members
452,893
Latest member
denay

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