Data validation

knight48

New Member
Joined
Oct 11, 2005
Messages
6
I have a table that contains one field that MUST be 9 digits exactly.
I usually import this data from excel and rename the new table to be the one I need.
Is there a way that I can either:
Import data from excel and then do a check on this field for errors or
If I keep the table stucture and import the new data into this table, a way I can require the field to be 9 digits and error out those that are not?

Thanks
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Assuming that your 9-digit field will be text...

Go into Design View in the table, select the field, and in the Validation Rule property at the bottom of the screen, put this:
Like "000000000"
You can also put a validation message that fires when an incorrect value is entered -- but you'll find this a pain if you are importing.

Save and return to Datasheet view.

To test, right-click the title bar and choose "Test Validation". It should tell you whehter any records violate the validation rule(s).

If you want validation at import time, set up your system so you import into the table (delete existing records first if you importing a full data set, otherwise just append the records). When you finish importing, check out the Import Errors table -- it will have been created if you had any issues. Offending records should be in there.

Denis
 
Upvote 0
Many thanks!
Tried this and I keep getting errors that data failed the validation. I have gone in an checked that the data is indeed text and that currently all fields are the 9 digits needed. Any thoughts?
 
Upvote 0
data validation

have you tried using expression builder in your data validation LEN(Variable name) = 9 as a rule?
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,549
Members
449,089
Latest member
davidcom

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