+ Reply to Thread
Results 1 to 7 of 7

splitting a cell that has two values separated by a space

  1. #1
    Registered User
    Join Date
    09-22-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    38

    splitting a cell that has two values separated by a space

    Hi,
    I'm here cause I'm stumped. I have a massive amount of pdf's that need to have data extracted so I can run some analysis. After searching around the net and trying out several ocr and pdf file converters, I found a program that spits out the data I'm trying to work with in a relatively acceptable manner however there is a LOT of reformatting and reentering of data involved. I have used LEN/RIGHT/LEFT functions to extract data out of a string, but I don't think these functions will do what I need done especially when the character strings are not consistent in length and there is no 'trigger' to look for except that the values are separated by a space . I have a feeling to get what I want, VBA might be the only way. While relatively experienced with Excel I am an ultra newbie to VBA and I'm willing to learn. The extent of my VBA is finding a template and adjusting to my needs.

    I can greatly reduce the amount of time of the data reentry if I can figure out how to solve this conundrum: I have columns represent a particular type of statistic, and then the rows are the record that the stat applies to. However each corresponding cell intersections has two points of data which correspond to year 1 and year 2. I want to get each of these pieces of data into their 'own' cell and in the correct row. The data I need to split is displayed as a 'wrap text' which can easily be undone, please see my attachment with the ideal before and after array. Thanks in advance for the help!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: splitting a cell that has two values separated by a space

    use two formulas to separate

    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.
    reattached your example

    also FYI char(10) = carriage return (or line feed) not space
    Attached Files Attached Files
    Last edited by humdingaling; 06-13-2013 at 08:04 PM. Reason: extra info
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: splitting a cell that has two values separated by a space

    to be more accurate....
    -1 to left formula to take carriage return away

    Please Login or Register  to view this content.
    and
    add 1 after find formula to take away extra carriage after
    Please Login or Register  to view this content.
    Last edited by humdingaling; 06-13-2013 at 08:06 PM.

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

    Re: splitting a cell that has two values separated by a space

    you can do it like this see attached
    Attached Files Attached Files
    "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

  5. #5
    Valued Forum Contributor
    Join Date
    10-29-2012
    Location
    Mojokerto,Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    554

    Re: splitting a cell that has two values separated by a space

    formula start at B11

    =TRIM(MID(SUBSTITUTE(OFFSET(B$2,TRUNC((ROW(1:1)-1)/2)+1,,,),CHAR(10),REPT(" ",100)),IF(ISODD(ROW(1:1)),1,100),100))

    drag right and down

  6. #6
    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: splitting a cell that has two values separated by a space

    Or to return numbers rather than text, see this workbook (The comma 1000 separator in the text string,needs an extra condition/function)

    Ghozis' use of ODD(), EVEN() could simplify the formulae I have used.
    I prefer to avoid volatile functions such as OFFSET()
    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.

  7. #7
    Registered User
    Join Date
    09-22-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: splitting a cell that has two values separated by a space

    Great solutions, tested them and they all work! Much appreciated ! I now have some new formulas to master and I just found an ASCII table so I can use CHAR more elaborately.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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