Counting Unique Values

handsdown

New Member
Joined
Jun 14, 2019
Messages
4
How would I go about calculating the unique values in Column A based on the criteria that Column B is not blank (any text at all)? In other words, in this example, the formula should output 2.

Column AColumn B
1
No
2Yes
2
3

<tbody>
</tbody>

Any help would be appreciated. Thank you in advance!
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
If there was text in column B for the 2nd 2 would the answer still be 2 or 3.

Would the answer be 2 or 3 for the below?
Excel Workbook
AB
1Column AColumn B
21No
32Yes
42No
53
Sheet


Would the answer be 2 or 3 for the example below?
Excel Workbook
AB
8Column AColumn B
91No
102Yes
112Yes
123
Sheet
 
Upvote 0
Try one of these array formulas.
The formula in cell D2 will work if the values in column A are text and/or numeric.
The formula in D4 is a little shorter, but will only work if column A is numeric.

Formulas need to be entered with CTRL-SHIFT-ENTER.
Excel Workbook
ABCD
1Column AColumn BCount
21No2
32Yes
422
53
Sheet
 
Upvote 0
Still isn't working. I have to do the entire column of A and B, as I am not sure how long this document may be.

I slightly modified it to become =SUM(IF(FREQUENCY(IF(B:B<>"",A:A),A:A),1)). However, I still run into the same problem I have been having. It counts the unique numbers, but doesn't recognize that Column B isn't filled on some rows.

For example, it says this is 3, when I want it to return 2.

Column AColumn B
1No
2Yes
2
3

<tbody>
</tbody>

Thanks for working with me and the help!
 
Upvote 0
See below it's working for me.
To use this formula column A must be numeric.
Also, did you enter the formula with CTRL-SHIFT-ENTER. If done right Excel will put brackets {} around the formula.
I you don't see the brackets, put the cursor in the cell with the formula then press the F2 (for edit) then CTRL-SHIFT-ENTER (on a PC).
Excel Workbook
ABCD
1Column AColumn BCount
21No
32Yes4
42
53
63
74Yes
84Yes
95
105
115No
Sheet
 
Upvote 0

Forum statistics

Threads
1,214,840
Messages
6,121,895
Members
449,058
Latest member
Guy Boot

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