Solved

Splitting Space Separated Items into Columns in Excel

Posted on 2014-09-13
8
366 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
 
LVL 68

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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 68

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

759 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now