Using Table Headers as ranges in Data Validation

prabutr28

New Member
Joined
Apr 1, 2020
Messages
3
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi Members,
I have a table named "Books". My table is very simple with 3 columns.
Book.ID, Book.Name, Book.Author
All i want to do is to avoid duplicate values in Book.ID column of a table using data validation.
I simply used the formula "=COUNTIF(Books[Book.ID],Books[@[Book.ID]])=1".

But it throws formula error window...

What am i doing wrong in this?

My table structure.
Book.IDBook.NameBook.Author
10001Sample Book 1Sample Author 1
10002Sample Book 2Sample Author 2
10001Sample Book 3Sample Author 3
 
I suggest not using data validation here. Instead, let the ID column enumerate itself via formula. Enter this in the Book.ID Column:
The assumptions there are that
- the OP wants the book ids to simply be a sequential list of numbers (which could be right - we haven't been told one way or the other)
- it would be okay for a particular book to have a certain id today and a different id tomorrow (if any rows were subsequently inserted mid-table)
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Gotcha. If you need static ID's that don't change, you can't use formulas. You need hard coded values. In that case, you can either enter them manually or use VBA to fill in blank values:

VBA Code:
sub BookIDs_Populate
 
Upvote 0
Sorry, hit enter too soon and now I can't edit that entry... so consider that an invalid entry... How's that for irony lol

Ok, anyways...

I recommend against manual entry if avoidable. I would use VBA to fill in blank cells automatically with the next sequential number. If the user MUST have the ability to enter these manually or looking to avoid VBA, then you can use Conditional Formatting to highlight duplicate entries. It won't outright stop the user from entering that value, but it will call out the discrepancy.
 
Upvote 0
I recommend against manual entry if avoidable. I would use VBA to fill in blank cells automatically with the next sequential number.
As far as we know, the OP is not trying to enter a list of sequential numbers..
All i want to do is to avoid duplicate values in Book.ID column


you can use Conditional Formatting to highlight duplicate entries. It won't outright stop the user from entering that value,
.. but Data Validation, as requested, can stop the duplicate entry.
.. avoid duplicate values in Book.ID column of a table using data validation.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,241
Members
452,622
Latest member
Laura_PinksBTHFT

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