How to ensure that cell entry in a specific range is always unique?

Mark McInerney

Active Member
Joined
Apr 4, 2012
Messages
291
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a range B1:B20. These cells are populated by the user and I want to ensure that no two entries are the same. Is there a way of presenting a dialog box that prompts the user to enter a different value if the value they are trying to enter is already entered somewhere in the range?

Any advice appreciated - Mark.
 
Use Data Validation. On the Settings tab, from the Allow Box, choose Custom. In the formula box, enter the following:
=COUNTIF($B$1:$B$20,B5)<2
 
Upvote 0
Hi Neil,

Slight problem - it works fine when checking the cell against the one above it.

It won't let me place "Joan" in B1 and B2, but it will allow me to place Joan in B5? Is there a way to avoid this?

Thanks - Mark.
 
Upvote 0
My bad. Select the entire range, then enter the below as the Validation formula:
=COUNTIF($B$1:$B$20,B1)<2
 
Upvote 0

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