Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default mixing zip with zip+4 and then sorting

I have a zip code column that has both standard zips (5 digits) and zip +4
(00000-0000). When I sort by zip it sorts all the 5-digit zips separately
(at the beginning) from the zip+4. How can I get it to sort and mix them
together in proper order?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default mixing zip with zip+4 and then sorting

Create 2 side by side helper columns, one for the 5 digit zip prefix and
another for the 4 digit suffix. For the example I'll assume that the zip
codes start in D1:

In the first helper column enter the following formula to extract the 5
digit zip:

=LEFT(D1,5)

In the second helper column enter the following formula:

=IF(LEN(D1)=10,RIGHT(D1,4),"")

The IF statement only gets the 4 digits if the zip is 10 characters long.


Copy both formulas down to the last address in your table.

Now when you do your sort sort by the 5 digit zip formula column as your
primary and the 4 digit zip formula column as your secondary.

Hope this helps.
--
Kevin Backmann


"JWCrosby" wrote:

I have a zip code column that has both standard zips (5 digits) and zip +4
(00000-0000). When I sort by zip it sorts all the 5-digit zips separately
(at the beginning) from the zip+4. How can I get it to sort and mix them
together in proper order?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 903
Default mixing zip with zip+4 and then sorting

You want to format the column as text (string data), to fix what you have, see
Rearranging Data in Columns (join.htm), subtopic ...
Fix up for 5 digit US zip codes (#fixUSzip5)
http://www.mvps.org/dmcritchie/excel/join.htm#fixUSzip5

You can enter zip code as 09876- and it will be a text,
but formatting the column ahead of time as text is best.
--
HTH,
David McRitchie, Microsoft MVP -- Excel
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm

"JWCrosby" wrote...
I have a zip code column that has both standard zips (5 digits) and zip +4
(00000-0000). When I sort by zip it sorts all the 5-digit zips separately
(at the beginning) from the zip+4. How can I get it to sort and mix them
together in proper order?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mixing text and formulas in the same cell johnu Excel Discussion (Misc queries) 4 September 16th 08 10:49 PM
mixing up a list dkb43 Excel Discussion (Misc queries) 1 August 6th 08 08:20 PM
Mixing up the arguments michaelr586 Excel Worksheet Functions 2 September 24th 05 09:54 AM
Sorting & Filtering in Shared Workbook mixing up data Marius Excel Worksheet Functions 0 July 25th 05 02:53 PM
Mixing chart types E Halliday Charts and Charting in Excel 2 May 16th 05 01:43 PM


All times are GMT +1. The time now is 08:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"