IF statements

D

Dwain Kincaid

How do I use an IF statement to look at a column of data and if the current
value or text is repeated in that column to return a null or NA value?
 
R

Rick Rothstein \(MVP - VB\)

I'm not entirely clear what you want displayed. If we display a "null" for
duplicates, then what do we display for unique entries. The formula below
assumes we will show unique items and show nothing for an items that are not
unique...

=IF(COUNTIF(A:A,"="&A1)=1,A1,"")

Here I have assumed your data is in Column A.

Rick
 
R

Rick Rothstein \(MVP - VB\)

I keep forgetting that you don't need the "=" part for text constants. This
will also work...

=IF(COUNTIF(A:A,A1)=1,A1,"")

Rick
 
M

Max

Dwain Kincaid said:
How do I use an IF statement to look at a column of data and if the current
value or text is repeated in that column to return a null or NA value?

One way
Assuming data to be looked at is running in A1 down
you could put in say, B1:
=IF(A1="","",IF(COUNTIF(A:A,A1)>1,"",A1))
and copy down to the max expected extent of data in col A
 
D

Dwain Kincaid

Rick:

Actually I want the first instance of a duplicate to show up and then any
repeats to either show null of "".
 
R

Rick Rothstein \(MVP - VB\)

Then give this formula a try...

=IF(COUNTIF(A$1:A1,A1)=1,A1,"")

Rick
 
Top