Data Validation - 3 Letters + 2 Numbers

tlc53

Active Member
Joined
Jul 26, 2018
Messages
399
Hi,

Can someone please tell me where I am going wrong here?

=AND(LEN(A62)=5,ISTEXT(LEFT(A62,3),ISNUMBER(RIGHT(A62,2))))

Thanks!
 
Wow, a lot more complicated than I had imagined. You were correct to assume the letters should be in caps. I tested it out and it works perfectly. Thanks so much :)
Glad it was what you wanted. :)
 
Upvote 0

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
I have assumed that any letters must be upper case. If so, try this for your custom DV formula.

=AND(LEN(A1)=5,OR(MAX(ABS(77.5-CODE(MID(A1,ROW(INDIRECT("1:3")),1))))<13,ISNUMBER(-MID(A1,ROW(INDIRECT("1:3")),1))),ISNUMBER(-MID(A1,ROW(INDIRECT("4:5")),1)))
Peter, am I mistaken or is your formula returning TRUE for situations where one of the three first characters is non-alphanumeric? For example 1-2345 or 12?45 or -1234 and so on.

While you ponder that, here is a formula I came up with which I think is foolproof (I'm sure I'll end up having to eat my words on that:eek:)...

=ISNUMBER(SUM(FIND(MID(A1,ROW(INDIRECT("1:3")),1),"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"))+SUM(FIND(MID(A1,ROW(INDIRECT("4:5")),1),"0123456789")))
 
Last edited:
Upvote 0
Peter, am I mistaken or is your formula returning TRUE for situations where one of the three first characters is non-alphanumeric? For example 1-2345 or 12?45 or -1234 and so on.
Thanks Rick
I thought I had tested such values but clearly not, as looking back at the logic of my formula you are perfectly correct

(I'm sure I'll end up having to eat my words on that:eek:)...
Also correct, but I think only in that you have omitted the 5-character test. :)


So, with a variation to shorten it up even with that additional test, maybe this ..

=(LEN(A1)=5)*(COUNT(FIND(MID(A1,ROW(INDIRECT("1:5")),1),"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",IF(ROW(INDIRECT("1:5"))<4,1,27)))=5)
 
Upvote 0
Solution
...but I think only in that you have omitted the 5-character test. :)
I forgot to include that??? Really??? I am so embarrassed! :oops:



So, with a variation to shorten it up even with that additional test, maybe this ..

=(LEN(A1)=5)*(COUNT(FIND(MID(A1,ROW(INDIRECT("1:5")),1),"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",IF(ROW(INDIRECT("1:5"))<4,1,27)))=5)
I like this variation.
 
Upvote 0

Forum statistics

Threads
1,223,749
Messages
6,174,288
Members
452,554
Latest member
Louis1225

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