cell contents - 10 digits or greater

ajm

Well-known Member
Joined
Feb 5, 2003
Messages
2,056
Office Version
  1. 365
Platform
  1. Windows
I am trying to force my users into giving me data in a certain format. this particular cell needs to be atleast 10 numbers long, or if its greater than 10, the eleventh must be "/" followed by a last single numeric. for example: 1234567891 or 1234567899/1
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
I am trying to force my users into giving me data in a certain format. this particular cell needs to be atleast 10 numbers long, or if its greater than 10, the eleventh must be "/" followed by a last single numeric. for example: 1234567891 or 1234567899/1
Can the digit string start with leading zeros?

0004567890

0004567890/0
 
Upvote 0
i guess it could. these 10 digit numbers are for consignment notes (CN) which start at 4000000000. i don't think there will ever be an instance where a CN would start with zero though.
 
Upvote 0
i guess it could. these 10 digit numbers are for consignment notes (CN) which start at 4000000000. i don't think there will ever be an instance where a CN would start with zero though.
Try this...

Apply Data Validation

Let's assume you want to apply this rule to cell A1.

Select cell A1
Data>Validation
Allow: Custom
Formula:

=OR(AND(LEN(A1)=10,A1>=4000000000,A1<=9999999999),AND(LEN(A1)=12,--LEFT(A1,10)>=4000000000,--LEFT(A1,10)<=9999999999,MID(A1,11,1)="/",COUNT(-RIGHT(A1))))
 
Upvote 0
thanks biff. something is awry with the validation as it keeps coming up with the error message that the value is not valid. it has something to do with the "mid" part of the formula and I will play with it from there until it works. many thanks for the kick start.
 
Upvote 0
thanks biff. something is awry with the validation as it keeps coming up with the error message that the value is not valid. it has something to do with the "mid" part of the formula and I will play with it from there until it works. many thanks for the kick start.
Here's what the formula allows:

Length must be 10 characters
The number must be >=4000000000 and <=9999999999

OR

Length must be 12 characters
The 1st 10 characters must be a number >=4000000000 and <=9999999999
The 11th character must be a slash: /
The 12th character must be a number from 0 to 9
 
Upvote 0
Isn't "Length must be 10 characters" redundant if "The number must be >=4000000000 and <=9999999999"

also, try this for the third condition of the second OR
COUNT(-RIGHT(A1))=1
 
Upvote 0
yes. length =10 is redundant. and with the change you suggest mike and with biff's original custom formula, i get the value entered is not valid error message when entering anything in that cell. the first condition works, that is that the number must be bewteen 4000000000 and 9999999999, so it must be due to second condition. I am playing around with that second one now and will post if i can make it work.
 
Upvote 0
Isn't "Length must be 10 characters" redundant if "The number must be >=4000000000 and <=9999999999"
Yeah, I guess it is.

also, try this for the third condition of the second OR
COUNT(-RIGHT(A1))=1
Why?

Isn't that redundant? ;)

COUNT(-RIGHT(A1))

Will return either 1 or 0.

If it returns 1 then AND evaluates that as TRUE. If it returns 0 then AND evaluates it as FALSE.
 
Last edited:
Upvote 0
Here's what the formula allows:

Length must be 10 characters
The number must be >=4000000000 and <=9999999999

OR

Length must be 12 characters
The 1st 10 characters must be a number >=4000000000 and <=9999999999
The 11th character must be a slash: /
The 12th character must be a number from 0 to 9

yes. length =10 is redundant. and with the change you suggest mike and with biff's original custom formula, i get the value entered is not valid error message when entering anything in that cell. the first condition works, that is that the number must be bewteen 4000000000 and 9999999999, so it must be due to second condition. I am playing around with that second one now and will post if i can make it work.
Are the "rules" I summarized in that other post correct?
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,850
Members
452,948
Latest member
UsmanAli786

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