Count of unique values

M

Matt

I have 2 columns of data, A1:A10 has just numbers eg 123, 456 etc, B1:B10 has
a combination of letters and numbers eg ABC123, DEF456 etc. The data is not
continous within each column (ie there are blank rows within each range).

I need a formula for each range which will count the number of unique values
within each column. I have tried to find solution in similar Q&As but can't
seem to find a solution which will disregard the empty cells and not return a
#DIV/0! result.

Any help would be great. Thanks.
 
M

Mike H

Matt

Put this in a cell and array enter. See below for array instructions. Drag 1
column to the right for column B

=SUM(COUNTIF(A1:A10,A1:A10)/IF(NOT(COUNTIF(A1:A10,A1:A10)),1,COUNTIF(A1:A10,A1:A10))^2)

'This is an array formula which must be entered by pressing CTRL+Shift+Enter
'and not just Enter. If you do it correctly then Excel will put curly brackets
'around the formula {}. You can't type these yourself. If you edit the formula
'you must enter it again with CTRL+Shift+Enter.

Mike
 
M

Matt

Thanks Mike.

Works great.

--
Regards
Matt


Mike H said:
Matt

Put this in a cell and array enter. See below for array instructions. Drag 1
column to the right for column B

=SUM(COUNTIF(A1:A10,A1:A10)/IF(NOT(COUNTIF(A1:A10,A1:A10)),1,COUNTIF(A1:A10,A1:A10))^2)

'This is an array formula which must be entered by pressing CTRL+Shift+Enter
'and not just Enter. If you do it correctly then Excel will put curly brackets
'around the formula {}. You can't type these yourself. If you edit the formula
'you must enter it again with CTRL+Shift+Enter.

Mike
 
M

Max

Matt,
Just pondering quietly why you weren't able to get Bob's & my response to
work for you. All 3 responses work ok in light testing over here. Any clues?
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:22,500 Files:370 Subscribers:66
xdemechanik
 
M

Matt

Thanks Max

Works great. Sorry I didn't get back to you earlier. All 3 answers work
fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top