Uniques only?

Jaymond Flurrie

Well-known Member
Joined
Sep 22, 2008
Messages
919
Office Version
  1. 365
Platform
  1. Windows
Is there any easy function that returns true/false based on whether the passed range argument has only unique values (so no value is twice on the list)?

I have so far done this so that I use two columns and make a countifs-formula that compares the value on the other column to all values on the other column and counts the amount of similar rows and then I take max of those numbers and compare that to number one. It just seems pretty complicated. And more than anything, it works only with Excel 2007.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Is there any easy function that returns true/false based on whether the passed range argument has only unique values (so no value is twice on the list)?

I have so far done this so that I use two columns and make a countifs-formula that compares the value on the other column to all values on the other column and counts the amount of similar rows and then I take max of those numbers and compare that to number one. It just seems pretty complicated. And more than anything, it works only with Excel 2007.

Given A1:A5

a1, 1
a2, 2
a3, 5
a4,
a5, X

what is the desired outcome? Note that A4 is an empty cell.
 
Upvote 0
Try:
=(SUMPRODUCT(COUNTIF(A1:A5,A1:A5))=COUNTA(A1:A5))

where A1:A5 is the range you want to evaluate. It will return TRUE if the values are unique and FALSE if the list contains duplicates
 
Upvote 0
It's true, since 1 is not 2 is not 5 is not "" is not X

If formula-blanks (i.e., "") and empty cells are possible...

Control+shift+enter, just enter:
Code:
=SUM(IF(FREQUENCY(IF(A1:A5<>"",MATCH("~"&A1:A5,A1:A5&"",0)),
   ROW(A1:A5)-ROW(A1)+1),1))=COUNT(A1:A5)+COUNTIF(A1:A5,"?*")
Or:

=SUMPRODUCT((A1:A5<>"")/COUNTIF(A1:A5,A1:A5&""))=COUNT(A1:A5)+COUNTIF(A1:A5,"?*")

The formula assumes a range free of non-numeric and non-text values.
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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