View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
David McRitchie[_2_] David McRitchie[_2_] is offline
external usenet poster
 
Posts: 134
Default sorting zip codes

and you would have to format them as 00000
so that numbers like 6300 would be 06300.

US zip codes from Italy, how interesting.

I would suggest formatting them as text and have a
FixUSzip5 macro to help with that.
http://www.mvps.org/dmcritchie/excel/join.htm#fixuszip5

Then you can include numbers like 06300-1222
mixed in with 06300 and they will sort correctly. Of course
this would not work have 5 digit and 9 digit codes if the purpose
is to use VLOOKUP. But using a text format would allow you
to use zip codes (or whatever other call them) from any part
of the world in the same column. Outside the US mostly familiar with
Canadian codes, and the system in England is really interesting,
all the more reason to use text.
--
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Dave Peterson" wrote in message ...
Make sure all of your data is the same type--all text or all numbers. (if you
want to convert the text to numbers, select an empty cell and copy it. Select
your range and do Edit|paste special|check Add.)

Do it to both the lookup list and the value used to look up.



Pier Luigi wrote:

hi,
in this reporti can't sort correctly the zip code, and sometime i can't
find
them when i search them with a function vlookup. wHY?
Pier

PROV ZIP CODE
TO 10052
TO 10056
TO 10060
AO 11021
VA 21013
VA 21013
BG 24030
BG 24063
VB 28900
VB 28900
VB 28900
VB 28900
VB 28900
VB 28900
VB 28900
VB 28900
UD 33013
TS 34123
BO 40050
AR 52010
AR 52040
NA 80056
BO 40024
BO 40024
BO 40024
BO 40025
BO 40025
BO 40026
BO 40026
BO 40026
BO 40026
BO 40027
BO 40027
BO 40030

RM 00100


--

Dave Peterson