+ Reply to Thread
Results 1 to 7 of 7

For a column of cells, separate the text in a single cell across multiple columns

  1. #1
    Registered User
    Join Date
    11-27-2013
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2007
    Posts
    7

    For a column of cells, separate the text in a single cell across multiple columns

    New task for work today, which involves creating a spreadsheet for all existing members of an organization. I went to the organization's website and copied all of the names & info, then pasted into a blank spreadsheet. Thankfully, all of the entries were separated into their own rows, but all of the information is only in one column. Take a look at my sample:

    (NOTE: does not contain actual names or info) Book1.xlsx

    This sample only contains 5 entries, but my actual list contains about 200; if it had just been the 5, I would have been fine with manually separating the information, but for 200 entries I need something much faster. You'll notice in the sample that the company, person, address, phone number, email, and website (when there) are not separated by anything. I know that using Text-to-Columns, I would technically be able to achieve what I need using the Delimited option, but I can't imagine this working without separators. I thought perhaps there might be a way to separate them based off font changes or something? Or maybe some way that I can insert a semi-colon or some kind of separator between the necessary data?

    While the font is Arial for the majority of the entries, in terms of font changes: company font size is 12 and color is navy blue; the person's name is size 18, bolded, and dark grey; the address & phone number are size 9 and the color is light gray; and finally, the email & website are also size 9, but navy blue in color. However, you'll notice that two of the five entries are formatted differently. This is because formerly, the entire cell & its text were a hyperlink to the email. I went ahead and removed these hyperlinks, simply using a "Remove Hyperlink" macro walkthrough I found on the web, but now these cells are uniformly set to Calibri and size 11, my default font setting.

    I really have no idea what my options are in trying to achieve this separation, but I'm open to anything you guys can offer. You were all very helpful with my last post, and I'm hoping for the same results this time too. If this is something that requires VBA or macros, I'll need some step-by-step instructions to help me along; while I consider myself fairly proficient with excel in general, I'm still completely new to macros & VBA.

    Thanks for any help you might have!

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: For a column of cells, separate the text in a single cell across multiple columns

    did you try importing from web rather than copy /pasting? data tab/get external data/from web
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: For a column of cells, separate the text in a single cell across multiple columns

    If you can't get a better import from the WEB, try separating the text in Word. I used your sample and ran this series of Find and Replace using wild cards in Word.

    Find: ([a-z])([A-Z])
    Replace With: \1^t\2

    Find: ([a-z])([1-9])
    Replace With: \1^t\2

    Find: ([1-9])([a-z])
    Replace With: \1^t\2

    Find: http
    Replace with: ^thttp

    Find: , (that's a comma....don't include this in the brackets)
    Replace with: ^t


    Copy back to Excel and Text to Columns with Tab as delimiter.

    This isn't absolutely perfect but it isn't bad at all.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  4. #4
    Registered User
    Join Date
    11-27-2013
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: For a column of cells, separate the text in a single cell across multiple columns

    I did try that, but the webpage doesn't really cooperate with me there. However, I did manage to copy&paste the data with everything separated how I desired. It's all still in one column, so now it's a matter of rearranging everything into proper format.

    Since the number of rows for each entry varies, I figured the best way to go would be to base the formatting around the cells containing phone numbers. The phone number is always the 4th row of each entry, so is there a way to say:

    "If a cell in Sheet1 CONTAINS ###-###-####, then in Sheet2 place the 3rd cell above that one (Company Name) in the 1st available cell in Column A. Place the 2nd cell (Name) in the same row, but in Column B. Place the 1st cell (Address) in the same row, but in Column C. The cell that contains the phone number then gets placed in Column D......"

    Essentially, that's what I'm now trying to achieve. My difficulty is that I'm not sure how to handle the cell(s) below the phone number, since each entry will either have just one cell for email, or two cells for email & website. Cleary the 1st cell below each phone number can be put in Column E, but for the websites (2nd cell below phone number) I think it would probably have to be something along the lines of "If the 2nd cell below a phone number (A6, for example) in Sheet1 does not match the cell in Column A on the row below in Sheet2 (If Sheet1!A6 doesn't match Sheet2!B1), then enter that cell in Column F. If it matches, do nothing and proceed with the rest of the data.

    So the end result should be that for every 5 or 6 rows in the first sheet, there is a dedicated row with 5-6 columns on the second sheet. What would be even better is if the formula rearranges the cells to have the same effect, so I don't have an extra sheet. Thanks for the help!

    New Workbook: Book2.xlsx

  5. #5
    Registered User
    Join Date
    11-27-2013
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: For a column of cells, separate the text in a single cell across multiple columns

    Thanks newdoverman, I'll give that a shot as soon as I get home!

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: For a column of cells, separate the text in a single cell across multiple columns

    do you mean something like this?
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-27-2013
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: For a column of cells, separate the text in a single cell across multiple columns

    Yes! That works Martin, thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to separate a single column of text cells and date cells
    By MelindaCapri in forum Excel General
    Replies: 18
    Last Post: 11-16-2012, 05:55 PM
  2. [SOLVED] How to separate csv from a single column to multiple columns
    By gmckenna in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-23-2012, 12:51 PM
  3. Transpose multiple text-based columns to single column while retaining record ids
    By SchoobsVT in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-06-2010, 12:26 PM
  4. Using Text to Columns on multiple but separate cells
    By rosef in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 11-25-2009, 03:02 PM
  5. [SOLVED] split a single column into 2 separate columns
    By Eve in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-14-2005, 04:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1