Data validation question

Triniirish

New Member
Joined
Sep 13, 2011
Messages
2
I am trying to develop a *.dbf file that requires specific number of characters in a field. My approach is to have various columns for the different fields and use data validation to specify the number of characters allowed in the respective column.

I am hoping that there is a way to get get a specific number of characters using a formula in the data validation even if less characters are inputted.

Example if I need 15 characters and only 5 are inputted could a formula in data validation insert the other ten either as spaces or zeros?

I was assuming that it would be a formula with LEN... something like
IF((LEN(A2)<15, then add/insert " ", so that LEN(A2)=15) I have no idea how to write a formula that would do this.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Welcome to the board...

Example if I need 15 characters and only 5 are inputted could a formula in data validation insert the other ten either as spaces or zeros?

No, not in data validation.
Data Validation only allows/disallows entry based on specified rules.
It cannot alter the input.


I would suggest a formula in an adjescent column.

if you want the spaces AFTER the entered value
=LEFT(A1&REPT(" ",15),15)


If you want the spaces BEFORE the entered value
=RIGHT(REPT(" ",15)&A1,15)


Then you have your adjusted values in the extra column, and you can use that for your .dbf file


Hope that helps.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,282
Members
452,902
Latest member
Knuddeluff

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