A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hello! Peter. Thanks for the details. You’re on the right track with COUNTIF, but you’re running into the usual problem: fixed ranges don’t expand or shrink with the table. Since you’re using a structured table (tblDataEntry), you can make the validation dynamic.
Here’s how you can do it:
Option 1: Use Structured Reference in Data Validation
- Select the whole column of your table where you want to prevent duplicates (e.g.
tblDataEntry[No.]). - Go to Data → Data Validation.
- In Allow choose Custom.
- Enter this formula: =COUNTIF(tblDataEntry[No.],[@No.])=1 Explanation:
-
tblDataEntry[No.]→ the whole column of the table. -
[@No.]→ the current row’s value. -
COUNTIF(...)=1ensures the value only appears once in the column.
-
Option 2: With INDIRECT (if structured references don’t work in validation)
Sometimes Excel rejects structured references in Data Validation. In that case, wrap it like this:
=COUNTIF(INDIRECT("tblDataEntry[No.]"),A7)=1
(where A7 is the first data row cell in your table’s No. column). Then apply it to the whole column of the table.
Option 3: Using UNIQUE (Excel 365+ only)
If you’re on Office 365, you can simplify with:
=COUNTIF(tblDataEntry[No.],[@No.])=1
Or validate against a dynamic spill range of unique values, but Option 1 is usually the cleanest.
See if this helps. If you need further assistance, just let me know.
Best regards,
Kimberly