Count unique values in column a where column b matches value

AlbertRBrowne

New Member
Joined
Jun 25, 2011
Messages
6
I need sum the amount of unique values in a column that match a value in another column.

a would contain say xxx, yyy, xxx
b Would contain bbb, ccc, bbb

I need to count the amount off times bbb appears but only once for xxx
I have this formula but it returns 0 and not the correct number.
=SUM(AND(H16:H50="bbb",(SUM(IF(FREQUENCY(IF(LEN(D16:D50)>0,MATCH(D16:D50,D16:D50,0),""),IF(LEN(D16:D50)>0,MATCH(D16:D50,D16:D50,0),""))>0,1)))))

Can anyone help thanks

Albert
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
I need sum the amount of unique values in a column that match a value in another column.

a would contain say xxx, yyy, xxx
b Would contain bbb, ccc, bbb

I need to count the amount off times bbb appears but only once for xxx
I have this formula but it returns 0 and not the correct number.
=SUM(AND(H16:H50="bbb",(SUM(IF(FREQUENCY(IF(LEN(D16:D50)>0,MATCH(D16:D50,D16:D50,0),""),IF(LEN(D16:D50)>0,MATCH(D16:D50,D16:D50,0),""))>0,1)))))

Can anyone help thanks

Albert
Try this...

Book1
AB
2BBBXXX
3BBBYYY
4BBBXXX
5BBBGGG
6BBBGGG
7BBBYYY
8BBBYYY
9BBBDDD
10BBBGGG
Sheet1

This array formula**:

=SUM(IF(FREQUENCY(IF(A2:A10="BBB",MATCH(B2:B10,B2:B10,0)),ROW(B2:B10)-ROW(B2)+1),1))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.

Assumes no empty cells within the data range of column B.
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,671
Members
452,937
Latest member
Bhg1984

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