Counting unique records with multiple criteria

gigimarga

New Member
Joined
Oct 25, 2010
Messages
18
Office Version
  1. 2016
Hi All,

I have the following dataset and I want the final answer to be a number of unique counts of "Record#", based on criteria 1=Variable1,"AAAA" and criteria 2=Variable2,"123". The two criteria are set as lists in a separate worksheet, so when the user selects variable 1 and variable 2, the result (formula) returns a value in a separate summary table. In the example here - based on the stipulated criteria (criteria 1=Variable1,"AAAA" and criteria 2=Variable2,"123") the value would be 2. Thanks in advance.

Record#Variable1Variable2
1AAAA123
1AAAB123
1AAAA123
2AAAA234
2AAAC234
3AAAA123
4AAAA456
 
Using Peter's layout, try:

Book2
A
1Unique Count
22
Sheet3
Cell Formulas
RangeFormula
A2A2=SUM(SIGN(FREQUENCY(IF((Sheet1!B2:B8=Sheet2!A2)*(Sheet1!C2:C8=Sheet2!B2),MATCH(Sheet1!A2:A8,Sheet1!A2:A8,0)),ROW(Sheet1!A2:A8)-ROW(Sheet1!A2)+1)))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Another option to consider.

gigimarga.xlsm
A
1Unique Count
22
Sheet3
Cell Formulas
RangeFormula
A2A2=COUNT(1/(MATCH(Sheet1!A2:A8&"|"&Sheet2!A2&"|"&Sheet2!B2,Sheet1!A2:A8&"|"&Sheet1!B2:B8&"|"&Sheet1!C2:C8,0)=ROW(Sheet1!A2:A8)-ROW(Sheet1!A2)+1))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,322
Members
452,635
Latest member
laura12345

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