Data validation question

Pauljj

Well-known Member
Joined
Mar 28, 2004
Messages
2,047
I need to a cell to contain either 3 numbers or 3 numbers and a letter only.

I.E 308, 305E

In that way, if a letter appeared in any other position this would be wrong or of there was more then 4 characters and less then 3 or 2 numbers and a letter...this would be wrong.

How could I stop this ?
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Let's say you want to do this on cell A1

Goto Cell A1

Choose Data Validation

Validation Criteria is "Custom"

Try this in the Formula and see if it works:

=IF(LEN(A1)=3,ISNUMBER(A1),IF(LEN(A1)=4,AND(ISERROR(VALUE(A1)),NOT(ISERROR(VALUE(LEFT(A1,3))))),FALSE))

Not pretty, but should do the job

:)
 
Upvote 0
I haven't got a clue how that works.....but it does ?

Thank you ever so much


Paul
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,264
Members
449,075
Latest member
staticfluids

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