Data Validation Letters and Numbers

forrestgump

New Member
Joined
Sep 30, 2010
Messages
22
Hi There, I want to create data validation so that the first 2 digits=PS and the next 4 digits will be numbers. I have tried a few things but I cant get anything to work? any help would be much appreciated.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I thought so too, but this
ISNUMBER(MID(A1,3,4)+0
will allow for only 3 numbers after PS

That's why I added the LEN=6

Good point, but the OP didn't actually specify that the string should be limited to 6 characters.
 
Upvote 0
Good point, but the OP didn't actually specify that the string should be limited to 6 characters.
hmm..
Hi There, I want to create data validation so that the first 2 digits=PS and the next 4 digits will be numbers. I have tried a few things but I cant get anything to work? any help would be much appreciated.
2+4 = 6

Perhaps it should be
>=6 instead of =6
 
Upvote 0
Thanks everyone. I went with =AND(LEFT(A1,2)="PS",MID(A1,3,4)+0,LEN(A1)=6). The part of the formula I don't understand is the +0. What does this do?
 
Upvote 0
Mid returns a TEXT string, the +0 converts that to a number.
And any number other than 0 works as a TRUE result for the AND function.
 
Upvote 0
Thanks everyone. I went with =AND(LEFT(A1,2)="PS",MID(A1,3,4)+0,LEN(A1)=6). The part of the formula I don't understand is the +0. What does this do?
That will work as long as you do not get an entry similar in structure to these... PS9e34, PS+9e4, PS(12), etc.
 
Upvote 0

Forum statistics

Threads
1,213,487
Messages
6,113,937
Members
448,534
Latest member
benefuexx

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