Cutom Validation for number length and decimal places

Branagorn

New Member
Joined
Apr 13, 2015
Messages
41
What would the custom formula be, to apply in data validation to only allow:

numbers only,
that are no longer than 7 digits long.
but also have no more than 6 decimal places.


also, probably a bit easier,
a number only, that has no more than 10 decimal places.


Any help would be greatly appreciated.

Many thanks, Alex
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
This should work for the first scenario -

=AND(IFERROR(NOT(LEN(MID(A1&"",FIND(".",A1&"")+1,99))>6),1),NOT(LEN(SUBSTITUTE(A1&"",".",""))>7),ISNUMBER(A1))
 
Last edited:
Upvote 0
This should work for the first scenario -

=AND(IFERROR(NOT(LEN(MID(A1&"",FIND(".",A1&"")+1,99))>6),1),NOT(LEN(SUBSTITUTE(A1&"",".",""))>7))

Thank you shobolos, however i must point out it works almost perfectly, apart from that it allows characters to be entered.

any thoughts?
 
Upvote 0
Maybe for the first,

=(INT(1000000*A1) = 1000000*A1) * (LEN(A1) <= 8)

And for the second,

=INT(10000000000*A1) = 10000000000*A1
 
Upvote 0

Forum statistics

Threads
1,203,514
Messages
6,055,836
Members
444,828
Latest member
StaffordStag

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