Solved

Splitting Space Separated Items into Columns in Excel

Posted on 2014-09-13
8
383 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 39

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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

785 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