View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
bpeltzer
 
Posts: n/a
Default Need to convert list of 5 digit zip codes to ranges where possible

A couple questions. Are the zip codes numeric or text? And what do you want
if there's a loner?
If the codes are numeric, and loners can be shown as 'groups of one' (ex
22033-22033), then here's one approach. If the zip codes are in column A and
sorted in ascending order, beginning in row 2, use column B to designate what
group each zip belongs to. In B2 enter the number 1. In B3 enter the
formula =IF(A3=A2+1,B2,B2+1). Then in column C we'll create the ranges. In
C2 enter the formula =IF(B2=B3,"",INDEX(A:A,MATCH(B2,B:B,FALSE)) & " - " &
A2). Copy that down to C3. Then select B3:C3 and autofill down.
HTH. --Bruce

"Mel07" wrote:


I have been unable to figure this one out. I have over 2000 zip codes
in a single column (One 5 digit zip code per row) which are already
sorted in numeric order. I need to put these individucal zip codes
into ranges where possible when zip codes are sequential (i.e.
91714-91734). Is this possible outside of doing this manually because
it's killing me!!! Help.


--
Mel07
------------------------------------------------------------------------
Mel07's Profile: http://www.excelforum.com/member.php...o&userid=32458
View this thread: http://www.excelforum.com/showthread...hreadid=522385