Restrict a column to allow for unique entries only?

G

Gabe

I have an Excel table linked to Access. I would like to
restrict one column to require all entries to be unique.
Is there a way to do this?
 
F

Frank Kabel

Hi Gabe
you can use Data - Validation for this:
Select all your cells in this column (assumption: column A, starting in
row 1) and enter the following formula in the validation dialog:
=COUNTIF($A$1:$A$999,A1)=1

Frank
 
G

Gabe

Thanks Everybody,
I really need something that will warn me if there is
duplication occuring as I'm pasting values into cells.
Is there a way to make this work? Sorry, I should have
pointed that out more strongly earlier.
 
H

Harlan Grove

I really need something that will warn me if there is
duplication occuring as I'm pasting values into cells.
Is there a way to make this work? Sorry, I should have
pointed that out more strongly earlier.
...

Data validation isn't triggered by pasting into cells. It only works upon actual
entry using keystrokes ending with [Enter] or [Ctrl]+[Shift]+[Enter]. If you'd
be pasting data, you need to use a Change or SheetChange event handler macro.
Such a macro could go through the cells entered prompting you for changes when
invalid entries are encountered.

What would you want to happen when an invalid entry was made? Note that there's
no way to *prevent* invalid *pasted* entries. It's only possible to deal with
them after the fact.
 

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