Solved

Splitting Space Separated Items into Columns in Excel

Posted on 2014-09-13
8
388 Views
Last Modified: 2014-09-18
When Mailchimp does an export of their standard address fields, it places the information into ONE CELL of the spreadsheet separated by double spaces:  (Look at the "address" section on this page:  http://kb.mailchimp.com/lists/growth/format-list-fields)

So my cell in Excel looks like this: Address1spacespaceAddress2spacespaceCityspacespaceStatespacespaceZip

Is there a formula or process in Excel that could be used to split those items into their own separate cell (column) in the spreadsheet?

The bottom line is I want to print address labels from the spreadsheet so an alternative would be producing address labels from that type of cell.

Thanks.
0
Comment
Question by:pkonstan1
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 40

Assisted Solution

by:als315
als315 earned 75 total points
ID: 40320808
You can use VBA split function, if you can use macros or formula from this sample
BkSplit.xls
0
 

Author Comment

by:pkonstan1
ID: 40320853
That is 90% of what I need.  
It works great when there are two address lines.

But when I have only one address line it fails. So can the macro be set up to allow for a BLANK Address2 field?

I also forgot that the country is at the end in a two digit code. So the CORRECT input field will be like this

Address1spacespacespacespaceCityspacespaceStatespacespaceZipspacespaceAA

And needs to be split into columns: Address1, Address2, City, State, Zip, Country

This is just what I was looking for, but I'm not super familiar with Excel formulas. I've written thousands of lines of PHP code and I could do it in a flash with PHP, but my brain doesn't dive into Excel much.  Thanks
0
 
LVL 27

Accepted Solution

by:
Glenn Ray earned 350 total points
ID: 40320963
Have you tried the Text-To-Columns feature (Excel menu: Data, Text-To-Columns)?  

After your data is inserted into column A, select TTC, then choose "delimited" and click the "Next" button. On the next screen, choose "Other" for delimiter and enter two spaces, then click the "Finish" button.  This should split your data.

Regards,
Glenn
Sent from my Windows Phone
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 69

Assisted Solution

by:Qlemo
Qlemo earned 75 total points
ID: 40320997
See revised and simplified XLS if you want to do it via formula.
BkSplit.xls
0
 

Assisted Solution

by:pkonstan1
pkonstan1 earned 0 total points
ID: 40321016
The formula provided by Olemo works fine when there is only ONE Address line, but it doesn't work when there are two.

So this address works:
1 Address1 St
City, State Zip

But this doesn't:
1 Address 1
Apt #2
City, State Zip

Then for Glenn Ray's offering, it "almost" works but can be made to work with one extra step and one specification.  The problem is that the "other" delimiter only allows for a single character to be entered, so the "two-space" option doesn't work.  The other problem is it converts zip codes with a leading zero to numeric and drops the zero.

Work Around for Single Character Entry.
The simple work around is to do a Search and Replace first and search for all double spaces and replace with some unused character (semi-colon or pip or left bracket...etc).  Then use that character as your delimiter.  

Be Sure To Specify Zip Code as "Text"
Then when you get to the screen that allows you to specify column types, switch the column for zip code from "general" to "text".

That's it.  Works perfect. Just what I needed.  Thanks.
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 40321050
Don't agree to the statement. The example workbook shows two different address sets, with one and with two address lines. Both work. Address lines are always in columns B and C, City is always in column D, aso.

If you found the Text-To-Columns suggestion to work for you (with modifications), that one should get the lion's share of points.
0
 
LVL 27

Expert Comment

by:Glenn Ray
ID: 40321072
Yup, sorry I didn't know you couldn't specify more than one delimiter for "Other" (makes sense, actually).  But I was posting via mobile and couldn't test.  Your idea of replacing all double spaces with another delimiter (ex,, pipe "|") was a good one.  And yes,  you'd want to selectively change the column data type to "Text" as-needed (ex., zip codes).

Regards,
-Glenn
0
 

Author Closing Comment

by:pkonstan1
ID: 40329896
Pointing me to an unknown feature in Excel is just what I needed.  This is perfect. Thanks.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question