Validation

  • Thread starter Thread starter donh
  • Start date Start date
D

donh

Hi hope you can help!

I have a serial number which is made up of a three letter prefix and
four numbers. The letters are area codes which there are only four
variations, numbers are random. I have used a Left() and IF() function
to validate the prefix but found a Right() function returns the digits
as text.

What I was working towards (probably in a long winded manor) was to
have the cell return a numeric value which would show as an error if
it contained any letters, ie there wasn't enough digits for the
Right() function to return a purely numeric string.

Am I on the right track? Is there a better way which would also catch
too many numbers entered?

As always any help would be much appreciated.


Regards

DonH
 
How about

=AND(OR(LEFT(A1,3)="ABC",LEFT(A1,3)="XYZ",LEFT(A1,3)="MTV",LEFT(A1,3)="PIP"),LEN(A1)=7,ISNUMBER(--RIGHT(A1,4)))

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Back
Top