How do you sort 9 digit zip codes in Excel?

G

Guest

Nine digit zip codes do not sort properly in Excel even when the cell is
formatted as "Special". I use Excel to sort for mailing labels and cannot
use 9 digit zipcodes because of the error. Help!
 
T

Tom Ogilvy

in an adjacent column put in a formula like (assume the zip is in C1)

=if(len(C1) = 5,text(C1,"00000")& "-0000",Text(C1,"00000-0000"))

Drag fill down the column, then sort on that column.
 
R

Ron Rosenfeld

On Sat, 21 May 2005 08:57:11 -0700, "Martha Parsons" <Martha
Nine digit zip codes do not sort properly in Excel even when the cell is
formatted as "Special". I use Excel to sort for mailing labels and cannot
use 9 digit zipcodes because of the error. Help!

Can you give an example of improperly sorted 9 digit zip codes? Although I
think I know what you mean, I was not able to replicate a sorting error.


--ron
 
D

David McRitchie

Martha (the OP), indicated she had the answer at the same time
you replied, evidently just new entries are the problem.

If there were a number of old entries you would want to convert
them to text, and I have a macro for that.
http://www.mvps.org/dmcritchie/excel/join.htm#fixUSzip5

Tom, a zip code of 7234 formatted as 00000 to show 07234
would test as a length of 4 =LEN(A1)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top