11

I have a column of zip codes which are strings. Most of them are the usual 5 digit zip codes, but some are only 3 digits or missing a digit. (keep in mind, I need this column as strings for other reasons)

ex.

ZIP
234
4566
12345

I basically want to select everything that has less than 5 characters for further investigation. I'm sure there's an easy way to do this, but I'm having a difficult time figuring it out.

  • 1
    Awesome, glad it worked! Will post it as an answer for the convenience of others :) – Joseph Dec 21 '15 at 15:03
17

Using the Select by Attributes tool, you could enter the following SQL query to select all features with less than 5 characters in the ZIP field:

CHAR_LENGTH("ZIP") < 5
-1

you could also use

Left("ZIP", 5)

to select features with 5 digits.

  • 1
    This will return the first 5 characters of any attribute but has little relation to the length of the attribute. – raphael Feb 7 '16 at 7:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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