Hello,
This is my first time using this forum so please be gentle. Your time and help would be greatly appreciated.
I've built a list of all zip codes in the US with their corresponding organization code, of which there are ~100. A total of ~42k rows.
I now need to group the data in a format consisting of a range of zip codes in each org, with a starting zip code and ending zip code. These ranges need to skip any zip codes not listed. So if a New York org went; 12540, 12541, 12542, 12543... on to 12553 then skipped to 12555, then to 12563 and carried on 12564, 15565... to 12572 the ranges would be 12540-12553, 12555 - 12555, 12563 - 12572. Below is an example of my data set and the format I need it in.
What I have:
[TABLE="width: 345"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]Zip Code[/TD]
[TD]State[/TD]
[TD]Org[/TD]
[/TR]
[TR]
[TD="align: right"]12541[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12542[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12543[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12544[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12545[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12546[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12547[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12548[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12549[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12550[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12551[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12552[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12553[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12555[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12561[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12563[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12564[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12565[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12566[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12567[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12568[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12569[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12570[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12571[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12572[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12574[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12575[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12577[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12578[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12580[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12581[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]501[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]544[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10001[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10002[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10003[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10004[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10005[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10006[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10007[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10008[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10009[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10010[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10011[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10012[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10013[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10014[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10016[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10017[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10018[/TD]
[TD]New York[/TD]
[TD="align: right"]3901
[/TD]
[/TR]
</tbody>[/TABLE]
What I need:
[TABLE="width: 473"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]STATE[/TD]
[TD]FROM_POSTAL_CODE[/TD]
[TD]TO_POSTAL_CODE[/TD]
[TD]ORG_CODE[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]12540[/TD]
[TD="align: right"]12553[/TD]
[TD] 3905[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]12555[/TD]
[TD="align: right"]12555[/TD]
[TD] 3905[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]12561[/TD]
[TD="align: right"]12561[/TD]
[TD] 3905[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]12563[/TD]
[TD="align: right"]12572[/TD]
[TD] 3905[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]12574[/TD]
[TD="align: right"]12575[/TD]
[TD] 3905[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]12577[/TD]
[TD="align: right"]12578 [/TD]
[TD]3905[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]501[/TD]
[TD="align: right"]501 [/TD]
[TD]3901[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]544[/TD]
[TD="align: right"]544[/TD]
[TD] 3901[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]10001[/TD]
[TD="align: right"]10048[/TD]
[TD] 3901[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]10055[/TD]
[TD="align: right"]10055[/TD]
[TD] 3901[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]10060[/TD]
[TD="align: right"]10060[/TD]
[TD] 3901[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]10065[/TD]
[TD="align: right"]10065 [/TD]
[TD]3901[/TD]
[/TR]
</tbody>[/TABLE]
I've been spinning my wheels on this for over a week. This is my last ditch effort before pushing back and admitting I can't do this.
This is my first time using this forum so please be gentle. Your time and help would be greatly appreciated.
I've built a list of all zip codes in the US with their corresponding organization code, of which there are ~100. A total of ~42k rows.
I now need to group the data in a format consisting of a range of zip codes in each org, with a starting zip code and ending zip code. These ranges need to skip any zip codes not listed. So if a New York org went; 12540, 12541, 12542, 12543... on to 12553 then skipped to 12555, then to 12563 and carried on 12564, 15565... to 12572 the ranges would be 12540-12553, 12555 - 12555, 12563 - 12572. Below is an example of my data set and the format I need it in.
What I have:
[TABLE="width: 345"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]Zip Code[/TD]
[TD]State[/TD]
[TD]Org[/TD]
[/TR]
[TR]
[TD="align: right"]12541[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12542[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12543[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12544[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12545[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12546[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12547[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12548[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12549[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12550[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12551[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12552[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12553[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12555[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12561[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12563[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12564[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12565[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12566[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12567[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12568[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12569[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12570[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12571[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12572[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12574[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12575[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12577[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12578[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12580[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]12581[/TD]
[TD]New York[/TD]
[TD="align: right"]3905[/TD]
[/TR]
[TR]
[TD="align: right"]501[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]544[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10001[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10002[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10003[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10004[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10005[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10006[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10007[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10008[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10009[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10010[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10011[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10012[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10013[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10014[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10016[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10017[/TD]
[TD]New York[/TD]
[TD="align: right"]3901[/TD]
[/TR]
[TR]
[TD="align: right"]10018[/TD]
[TD]New York[/TD]
[TD="align: right"]3901
[/TD]
[/TR]
</tbody>[/TABLE]
What I need:
[TABLE="width: 473"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]STATE[/TD]
[TD]FROM_POSTAL_CODE[/TD]
[TD]TO_POSTAL_CODE[/TD]
[TD]ORG_CODE[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]12540[/TD]
[TD="align: right"]12553[/TD]
[TD] 3905[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]12555[/TD]
[TD="align: right"]12555[/TD]
[TD] 3905[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]12561[/TD]
[TD="align: right"]12561[/TD]
[TD] 3905[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]12563[/TD]
[TD="align: right"]12572[/TD]
[TD] 3905[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]12574[/TD]
[TD="align: right"]12575[/TD]
[TD] 3905[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]12577[/TD]
[TD="align: right"]12578 [/TD]
[TD]3905[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]501[/TD]
[TD="align: right"]501 [/TD]
[TD]3901[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]544[/TD]
[TD="align: right"]544[/TD]
[TD] 3901[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]10001[/TD]
[TD="align: right"]10048[/TD]
[TD] 3901[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]10055[/TD]
[TD="align: right"]10055[/TD]
[TD] 3901[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]10060[/TD]
[TD="align: right"]10060[/TD]
[TD] 3901[/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD="align: right"]10065[/TD]
[TD="align: right"]10065 [/TD]
[TD]3901[/TD]
[/TR]
</tbody>[/TABLE]
I've been spinning my wheels on this for over a week. This is my last ditch effort before pushing back and admitting I can't do this.