0

I have a cell that should contain values like 123456789WA. The first 9 characters should always be numbers, and the last 2 should be WA. I can check the length to make sure it's 11, I can check the last two characters to make sure they're "WA", but I can't figure out how to check the first 9 to make sure they're numbers. ISNUMBER doesn't work because the cell is text, so it always gives a false. Here's my cell formula:

=IF(LEN(A2)<>11,"Not 11 char",IF(RIGHT(A2,2)<>"WA","Missing 'WA'",IF(ISNUMBER(LEFT(A2,9)),"","Left not numeric")))

I can do it in VBA, but this is something I'm passing off to very unsophisticated users, so I need to make it work in a cell. Any ideas?

0

1 Answer 1

1

With a value in A1, the first 9 characters can be tested with:

=IF(ISERROR(--LEFT(A1,9)),"not all numbers","all numbers")
1
  • BEAUTIFUL! Works like a charm.
    – PKatona
    Nov 2, 2018 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.