+ Reply to Thread
Results 1 to 10 of 10

Breaking up string of text in 1 cell into multiple cells

  1. #1
    Registered User
    Join Date
    07-14-2010
    Location
    Seattle, WA
    MS-Off Ver
    PC 03/07/10 | Mac 08/11
    Posts
    43

    Breaking up string of text in 1 cell into multiple cells

    I'm sure this has been asked, but the search function is failing me right now (not bringing up any results).

    I have a string of data that I copied from a pdf file into excel. All the data falls into 1 cell and I need to break up the data into multiple cells (multiple fomulas/VBA across multiple cells) to ensure that the correct data ends up in the correct cell/column.

    Sample String
    Last, First Middle (2731715) 111-222-3333 [email protected]
    Last, First [no-middle] (3053815) 111-222-4444 [email protected]

    All this data is in cell A1.

    The following cells are what pieces of information need to be populated into them.

    B1 - Last Name (no comma)
    C1 - First Name
    D1 - Middle Name
    E1 - String of Number with out the parenthesis
    F1 - Phone Number
    G1 - Email address

    I know for cell B1, I can use the formula =LEFT(A1,FIND(",",A1,1)-1) and it'll pull all the text prior to the comma.

    For cell C1, what makes sense in my [crazy] head would be to Find all text after what's in cell B1 up until the next "space" character.

    For cell D1, find all text after what's in cell C1 up until the next space character.

    For cell E1, find all text after what's in cell D1 and eliminating the parenthesis and only displaying the numbers

    For cell F1 - etc

    Cell G1 - etc

    I'm really good at copying and pasting VBA/Macros along with formula's into Excel. I can typically understand formulas but right now I'm having a rough time comprehending what needs to be done.

    Any help? Thanks folks!
    Last edited by dizzle; 02-28-2013 at 07:55 PM.

  2. #2
    Valued Forum Contributor loginjmor's Avatar
    Join Date
    01-31-2013
    Location
    Cedar Rapids, Iowa
    MS-Off Ver
    Excel 2013
    Posts
    1,073

    Re: Breaking up string of text in 1 cell into multiple cells

    Hi -

    You could try using the Text to Columns tool under the Data tab. Just highlight the cell all those strings are in, select th Text to Columns button.

    This will bring up a screen with two options: Pick Delimited and then select Next
    This will bring up a screen with some check boxes and a preview of how Excel will parse your data into columns. Check both Space and Comma. The preview pane will show you what you will get. Select Next.
    This next screen will allow you to apply special formats to any of the fields (or allow you to skip columns). Set it how you want and select Finish.

    Voila - your data should be parsed into columns.

    Hope this helps.

  3. #3
    Registered User
    Join Date
    07-14-2010
    Location
    Seattle, WA
    MS-Off Ver
    PC 03/07/10 | Mac 08/11
    Posts
    43

    Re: Breaking up string of text in 1 cell into multiple cells

    Thanks for the idea, but I'd like to avoid the text to columns as I would have to manually do that which each column. I'd like to be able to copy/paste data in Column A and have columns B-G auto populate with the correct data that I'd need.

  4. #4
    Valued Forum Contributor
    Join Date
    02-05-2013
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2013
    Posts
    571

    Re: Breaking up string of text in 1 cell into multiple cells

    Try this code:
    Column B1
    Please Login or Register  to view this content.
    Column C1
    Please Login or Register  to view this content.
    Column D1
    Please Login or Register  to view this content.
    Column E1
    Please Login or Register  to view this content.
    Column F1
    Please Login or Register  to view this content.
    Column G1
    Please Login or Register  to view this content.
    Column H1
    Please Login or Register  to view this content.
    Regards,
    SDCh
    Click (*) if you received helpful response.

    Regards,
    David

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Breaking up string of text in 1 cell into multiple cells

    If you are using 2003 as your profile suggests, I think you will need a helper column to change the string if there is no middle name

    In B2, drag/Fill Down. (This can be hidden with the +/- grouping button.)
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Then in C2, Drag Across and down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    If you are using a later version of Excel, you could replace $B2 with the helper formula, then the helper wouldn't be required.

    The "all in one" formula is to involved for 2003.
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  6. #6
    Valued Forum Contributor
    Join Date
    02-05-2013
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2013
    Posts
    571

    Re: Breaking up string of text in 1 cell into multiple cells

    @Marcol: Nice and simple formula I get new knowledge from this.

  7. #7
    Registered User
    Join Date
    07-14-2010
    Location
    Seattle, WA
    MS-Off Ver
    PC 03/07/10 | Mac 08/11
    Posts
    43

    Re: Breaking up string of text in 1 cell into multiple cells

    Sorry, I just realized my profile still states 2003 .. I'm using 07/10 for PC and 11 for Mac.

    Right now this is being made on Excel 07.

    I'll check through all these formulas, thanks for the help everyone!

  8. #8
    Registered User
    Join Date
    07-14-2010
    Location
    Seattle, WA
    MS-Off Ver
    PC 03/07/10 | Mac 08/11
    Posts
    43

    Re: Breaking up string of text in 1 cell into multiple cells

    I have attached the excel sheet (excel 2007) of what I'm trying to accomplish.

    In Column A, I have the data that I pulled from a PDF form.

    In Column B, I need the Last Name

    In Column C, I need the First Name

    In Column D, I need the Middle Name (if applicable)

    In Column E, I need the first set of numbers in the parenthesis

    In Column F, I need the Phone Number (with or without the dash)

    In Column G, I need the E-mail address

    For column's B, C, D & E, the formulas that SDCh created work flawlessly (THANK YOU!!!). For columns F-H, everything gets broken up (specifically the email address) and if you notice in column F3, the entire number doesn't even show up.

    Thank you for all your help on this!
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor
    Join Date
    02-05-2013
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2013
    Posts
    571

    Re: Breaking up string of text in 1 cell into multiple cells

    If you don't mind, we use the formula from Marcol with little change if you not want a helper column. Just drag across and down.
    Please Login or Register  to view this content.
    If you not want has "-" on middle name use this:
    Please Login or Register  to view this content.

    Note : Thanks to Marcol to show this formula No need to think and write different formula on every cell
    Last edited by SDCh; 03-01-2013 at 09:06 PM.

  10. #10
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Breaking up string of text in 1 cell into multiple cells

    If we introduce a named range then the problem can be further simplified.

    Name:= FullString
    Refers to:=
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Then in B2, Drag Across and Down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    This should work for all versions of Excel
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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