+ Reply to Thread
Results 1 to 14 of 14

Split text string into four cells

  1. #1
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Bryne, Norway
    MS-Off Ver
    Microsoft Office Excel 2010
    Posts
    230

    Split text string into four cells

    I need a function that split the content of the text strings below into four cells in each line. The functions shall of course be located in the four cells.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by mkvassh; 07-12-2010 at 10:11 AM.

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Split text string into four cells

    Hi

    could you please provide an example of the outcome you are looking for? Are ther spaces between each string?

  3. #3
    Registered User
    Join Date
    07-12-2010
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Split text string into four cells

    Hi, try the 'text to columns' function - go to the 'Data; menu - then 'Text to Columns' you can select the cell with the data then choose the delimiter - I tried it using 'space' as a delimiter and it returns the data in separate columns - you'd then need to put the 'Accounts' and 'Payable' bit back together - but that is a fairly quick one!
    remember though if you don't specify a new destination for the new columns, the divided data will replace the combined data.

  4. #4
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Bryne, Norway
    MS-Off Ver
    Microsoft Office Excel 2010
    Posts
    230

    Re: Split text string into four cells

    See attachment.

    I want to end up with the data in Column B - E based on data in column A. I'm aware of "text to columns", but that is not a good solution in this example since one have to adjust data afterwards. The plan is to use this on a lot of data.

    The problem here is of course the extra space in one of the line. I think a solution must split from right.

  5. #5
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Split text string into four cells

    Sorry, nothing attached - Edit your original post - Click " go advanced" and follow the attachment wizard

  6. #6
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Bryne, Norway
    MS-Off Ver
    Microsoft Office Excel 2010
    Posts
    230

    Re: Split text string into four cells

    Sorry. It is there now

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

    Re: Split text string into four cells

    If it is only one or 2 words as per your example
    then in B1
    =IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))=4,SUBSTITUTE(A1," ","^",1),A1)
    dragged down
    you can the copy paste special /values /back over this to remove formulas
    then use text to columns space as delimiter
    finaly find ^ replace " "
    Last edited by martindwilson; 07-12-2010 at 08:24 AM.
    "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

  8. #8
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Bryne, Norway
    MS-Off Ver
    Microsoft Office Excel 2010
    Posts
    230

    Re: Split text string into four cells

    Your suggestion will work, thanks, but there is a lot back and forth. I know how one can do this in vba (see link below), but isn't there a way to do this by using a function without using several steps?

    http://www.excelforum.com/excel-prog...xt-string.html

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

    Re: Split text string into four cells

    that takes aproximately 20 seconds to do!

  10. #10
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Bryne, Norway
    MS-Off Ver
    Microsoft Office Excel 2010
    Posts
    230

    Re: Split text string into four cells

    I agree, but isn't there a way to do this one go?

  11. #11
    Registered User
    Join Date
    04-15-2010
    Location
    Greeley, PA
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Split text string into four cells

    Try this (attached)

    Edit: to clarify, there are three different functions going across, but they should be draggable down, as long as the text in column B is the same length as the prefix text in column A.
    Attached Files Attached Files
    Last edited by SpeedingLunatic; 07-12-2010 at 10:00 AM.

  12. #12
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Bryne, Norway
    MS-Off Ver
    Microsoft Office Excel 2010
    Posts
    230

    Re: Split text string into four cells

    It's working. Thank you :-)

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

    Re: Split text string into four cells

    add in cell b1 of speedlunatics
    =IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))=4,LEFT(A1,FIND("^",SUBSTITUTE(A1," ","^",2))-1),LEFT(A1,FIND(" ",A1)-1))
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    03-02-2012
    Location
    Airoli
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Split text string into four cells

    I just want Formula
    to Split text into 4 columns Plz help

    If i enter a Full name eg: Mr Sachin Ramesh Tendulkar
    in one cell then by using find control
    i want dis cell splited and want each
    word in 4 colums of cell plz provide a formula
    on [email protected]
    thank You

+ 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