Data Validation - 5 Digit Number with exclusion list

tomexcel1

New Member
Joined
Feb 22, 2018
Messages
47
Hi All,

I'm looking for a data validation formula that can achieve the following:


  • Only allow the input of a 5 digit number
  • Don't allow the input of the 5 digit numbers in a list (The list is in cells F5020:F5045)

Any help is much appreciated

Thanks
Tom
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hi Tom,

In cell A1 (assuming A1 is where the custom rule is applied) try this:

=AND(ISNUMBER(A1),LEN(A1)=5,COUNTIF(F5020:F5045,A1)=0)

This says A1 must be a number, it must have length of 5 and it must not be equal to any of the values in F5020:F5045
 
Last edited:
Upvote 0
Thanks Tyija

When I use this formula in data validation it seams to let me enter anything in the cell. Any ideas why?

Thanks
Tom
 
Upvote 0
What range do you want to apply the set of rules to? I.e. numeric, 5digits, not in the list mentioned?

As for why you can enter anything in the cell - how have you referenced the data validation rule exactly?
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,177
Members
452,615
Latest member
bogeys2birdies

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