If you are required to add particular numbers with specific length in a range then you can make use of data validation. In this article, we will focus on extensive use of data validation custom feature to allow user to enter only x length & specific numbers and not all of them.
Question: I am using data validation, but I’m not able to help myself as my request is a little hard. I want excel to allow up to 5 digits & the digits that should be allowed are only 1,2,3,4,5,6 which implies 0,7,8,9 should not be allowed. In case user enters more than 5 digits or user enter any of the non-allowed digits, then excel must notify user with an alert message.
The functions we are going to use are AND, ISNUMBER, LEN, ISERROR & FIND.
We need to follow the below steps:
- Select the range where we want to apply data validation (A1:D10 in our example)
- Press ALT + D + L to open Data Validation box
- Select Custom
- In Formula box, enter the formula as
- The entire formula is not visible; in order to check, you can use mouse cursor; do not use keyboard arrows, this will cause error in formula
- Click on Ok button
Conclusion: In this way, we can use data validation to allow user to enter specific numbers with specific length.
If you liked our blogs, share it with your friends on Facebook. And also you can follow us on Twitter and Facebook.
We would love to hear from you, do let us know how we can improve, complement or innovate our work and make it better for you. Write us at firstname.lastname@example.org