Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

When is a NUMBER not a NUMBER?

Best of Excel

When is a NUMBER not a NUMBER?

by  SkipVought  Posted    (Edited  )

Numbers are values that we can do arithmetic operations to.

However, there are values that appear to be numbers, that, in reality, are not numbers. If, for instance, you have a value that needs leading zeros, because the length of the value is always the same, like a USPS ZIP Code, you are not working with a number; rather you have an IDENTIFIER.

IDENTIFIERS are values that can contain ALL numeric characters, but 1) you will NEVER use these values mathematically, 2) most often they have a defined length and 3) they are used to describe some entity. ZIP Codes, Invoice Numbers, Part Numbers, Phone Numbers, Social Security Numbers, Employee Numbers are some examples of IDENTIFIERS as opposed to NUMBERS, and, as such, need to be stored as TEXT values rather than NUMERIC values.

Why is this distinction important? Computers store NUMBERS in a significantly different way than TEXT. Computers manipulate NUMBERS in a significantly different way than TEXT. Have you ever had a column of TEXT and NUMBERS that you tried to SORT in Excel? Excel asks you how you want the values to be handled, because it can't figure it out without your input. If you do a QUERY on a column containing TEXT and NUMBERS, you will be sadly disappointed with the results.

Excel gives you some "help" by offering Numeric Formatting for ZIP Codes, Phone Numbers and Social Security Numbers. I AVOID this "help" because I consider these type of values TEXT and not NUMBERS. By doing so, I avoid ambiguities and confusion in my downstream processing.

What to do:
Convert numeric IDENTIFIERS to TEXT using the TEXT function.

If you are using Data > Import External Data > Import or Data > Text to columns, always choose TEXT, rather than GENERAL, for columns that contain IDENTIFIERS.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top