Data Validation -- Numbers in Text Field

CPGDeveloper

Board Regular
Joined
Oct 8, 2008
Messages
174
I can't seem to figure this out -- any help would be greatly appreciated.

I'm trying to validate a column in my excel workbook with the following criteria:

Length of 9 characters
Each character must be a number
The first character may be '0'.
The field itself should remain a text field.

So both 012345678 And 123456789 would be valid.

I have the following custom data validation formula:

=AND(ISNUMBER(B3), LEN(B3)=9)

But of course, this would eliminate '012345678', considering it 8 characters, not 9.

Any ideas? Thanks.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Try this:
Code:
=AND(ISNUMBER(B3+0),LEN(B3)=9)
 
Upvote 0
Try this:
Code:
=AND(ISNUMBER(B3+0),LEN(B3)=9)
I am guessing that for the kinds of values that will be entered into cell B3, your formula should be sufficient, but the OP should know that it is not fully robust as it will report TRUE for values like these...

April2018

1.23456E8

-1.23e-04
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,813
Members
449,469
Latest member
Kingwi11y

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