# Formula to return count of unique values in one column, for each different value in another column

#### aldousjg

##### New Member
Hi all,

I'm having trouble with a formula which needs to return a count of unique names found in one column for each unique combination of number and date found in two other columns. Hopefully this example explains it a bit better:

So for the combination of 123 and 01/01/2000, there is one unique name in the Names column and a value of 1 is returned, but for the combination of 456 and 03/03/2000, there are three unique names in the names column and a value of 3 is returned.

My actual dataset is a few thousand rows and I would now be able to specify actual values of number or date in a formula.

Could anyone help?

Thank you,

### Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

##### Well-known Member
You Can Use Countifs that have multiple criteria range and Criteria for each Range.

#### mart37

##### Well-known Member
count unique items with 2 conditions.xlsx
D
22
Cell Formulas
RangeFormula
D2D2=SUM(IF(--FREQUENCY(IF((\$A\$2:\$A\$16&"|"&\$B\$2:\$B\$16=A2:A2&"|"&B2:B2),MATCH(\$C\$2:\$C\$16,\$C\$2:\$C\$16,0)),IF((\$A\$2:\$A\$16&"|"&\$B\$2:\$B\$16=A2:A2&"|"&B2:B2),MATCH(\$C\$2:\$C\$16,\$C\$2:\$C\$16,0)))>0,1))
Press CTRL+SHIFT+ENTER to enter array formulas.

#### Fluff

##### MrExcel MVP, Moderator
Another option
Excel Formula:
``=ROWS(UNIQUE(FILTER(\$C\$2:\$C\$1000,(\$A\$2:\$A\$1000=A2)*(\$B\$2:\$B\$1000=B2))))``

Replies
13
Views
247
Replies
11
Views
212
Replies
1
Views
372
Replies
13
Views
186
Replies
3
Views
93

1,129,549
Messages
5,636,941
Members
416,953
Latest member
prakashkumar

### 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.

### Which adblocker are you using?

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

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