+ Reply to Thread
Results 1 to 4 of 4

[SOLVED] Splitting cell text strings at 4-digit number and at space after # symbol

  1. #1
    Registered User
    Join Date
    12-13-2012
    Location
    Portland, OR
    MS-Off Ver
    Excel 2003
    Posts
    61

    [SOLVED] Splitting cell text strings at 4-digit number and at space after # symbol

    First poster solved it, thank you both for the help!


    ----------------------
    original post:

    Here is an example of one cell out of thousands like it I'm trying to change:

    JASON KIPNIS 2013 Topps #267 Indians


    And here is what I'd like it to be:

    2013 Topps #267 JASON KIPNIS Indians



    I'm dealing with baseball cards, if you didn't know, and the years, brands, #s, players, and teams are all different.


    So what I think I need to do is split the cell at the first instance of a 4-digit number (the year), then again at the first space after the '#' symbol. This would hopefully leave me with 3 columns:

    JASON KIPNIS / 2013 Topps #267 / Indians


    At which point I can use the '&' formula to arrange the cells in the correct order in a new single cell.


    Can someone please tell me the formulas I should use to achieve this? Thank you very much!
    Last edited by portokie; 05-04-2013 at 08:59 PM. Reason: solved

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Splitting cell text strings at 4-digit number and at space after # symbol

    hi portokie. the 3 formulas you can try:
    =LEFT(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789"))-2)

    =MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),FIND(" ",A1,FIND("#",A1)+1)-MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")))

    =MID(A1,FIND(" ",A1,FIND("#",A1)+1)+1,LEN(A1))

    use TRIM if needed. that's to remove spaces before, after & more than 1 space in between

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Splitting cell text strings at 4-digit number and at space after # symbol

    Hi,

    Or try these three formulas:

    =TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",LEN(A1))),LEN(A1)*3,LEN(A1)*2))

    =TRIM(LEFT(SUBSTITUTE(A1," ",REPT(" ",LEN(A1))),LEN(A1)*3))

    =TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",LEN(A1))),LEN(A1)))
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: [SOLVED] Splitting cell text strings at 4-digit number and at space after # symbol

    I think I would use Data>Text to Columns to separate the string and then use a simple concatentation formula to reassemble in the order you want.

    For example:

    A2 = JASON KIPNIS 2013 Topps #267 Indians

    Select A2
    Goto Data>Text to Columns
    Select: Delimited
    Click: Next
    Select: Space
    Click: Finish

    The string will be separated like this:

    A2: JASON
    B2: KIPNIS
    C2: 2013
    D2: Topps
    E2: #267
    F2: Indians

    Then, use this formula to reassemble in the order you want:

    =C2&" "&D2&" "&E2&" "&A2&" "&B2&" "&F2

    Then, you could inspect the results to make sure you got what you wanted.

    Select the cell with the formula
    Right click>Copy
    Right click>Paste Special>Values
    OK

    Then, delete the original data in A2:F2
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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