Thread: Duplicate Data
View Single Post
  #4   Report Post  
Harlan Grove
 
Posts: n/a
Default

"Max" wrote...
One way via Data Validation ..

Select col A


With cell A1 active.

Click Data Validation
Make the settings:
Choose under "Allow:" : Custom
Formula: =COUNTIF($A$1:A1,A1)<=1
Click OK


Maybe, but two caveats. First, if the OP ever pastes text (from other
applications) into cells with validation, the validation is bypassed but
still in place, so it doesn't do anything to prevent duplicate entry.
Second, if any entries are text, Excel will treat text with different
numbers of trailing whitespace as distinct entries.

More technical, if the range in question is large, COUNTIF could become
slow. Better to apply validation to A2:A65536 and use the formula

=ISERROR(MATCH(A2,$A$1:$A1,0))

COUNTIF will interate through the entire range every time. MATCH will return
upon finding the first match, if there is one.