+ Reply to Thread
Results 1 to 7 of 7

Splitting Competition names

Hybrid View

  1. #1
    Registered User
    Join Date
    09-04-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Splitting Competition names

    Hi There,

    I wonder if anyone can help me... I need to split the following line up and make it Caps

    Jack Smith v Peter Jones

    I want it to look like

    SMITH v JONES

    I'm working on a competition and have to do hundreds of these.. is this possible in excel ?

    I've managed to split the first name by finding " " but I can't manage to get any further..

    any help greatly appreciated

    regards

    Alex
    Last edited by adinnin; 11-16-2010 at 10:40 AM.

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Splitting Competition names

    There's probably an easier way...but here's what I came up with:

    A1: Alfred E. Neuman v Bozo T. Clown
    A2: Papa Bear v Goldilocks
    A3: Atila T. Hun v Captain Ahab

    This regular formula parses the A1 text:
    B1: =UPPER(TRIM(RIGHT(SUBSTITUTE(LEFT(A1,FIND(" v ",A1)-1)," ",REPT(" ",50)),
    LEN(LEFT(A1,FIND(" v ",A1)-1))))&" v "&TRIM(RIGHT(SUBSTITUTE(RIGHT(A1,LEN(A1)
    -FIND(" v ",A1)-2)," ",REPT(" ",50)),LEN(RIGHT(A1,LEN(A1)-FIND(" v ",A1)-2)))))
    Copy that formula down through B3.

    With the above examples the formulas return:
    B1: NEUMAN V CLOWN
    B2: BEAR V GOLDILOCKS
    B3: HUN V AHAB

    I hope that helps.
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Valued Forum Contributor
    Join Date
    10-17-2010
    Location
    Nottingham, England
    MS-Off Ver
    Excel 2003, 2007, 2010, 2013, 2016, 2019, 365
    Posts
    294

    Re: Splitting Competition names

    If it's always firstname lastname (i.e. always 4 spaces), then this works:
    =UPPER(MID(A1,FIND(" ",A1)+1,FIND(" ",A1,FIND(" ",A1)+1)-FIND(" ",A1))&"v "&RIGHT(A1,LEN(A1)-FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)))
    which roughly translates as
    UPPER: Convert to upper case
    MID: Take the text out of the middle of A1, starting at the first space+1 character, length to extract is position of second space minus position of first space
    &"v " puts the v back in
    RIGHT: take the right-hand n characters from A1, where n is calculated by length LEN minus the position of the 4th space.

  4. #4
    Valued Forum Contributor
    Join Date
    10-17-2010
    Location
    Nottingham, England
    MS-Off Ver
    Excel 2003, 2007, 2010, 2013, 2016, 2019, 365
    Posts
    294

    Re: Splitting Competition names

    ...and if you want a lowercase v in the middle:
    =UPPER(MID(A1,FIND(" ",A1)+1,FIND(" ",A1,FIND(" ",A1)+1)-FIND(" ",A1)))
    &"v "
    &UPPER(RIGHT(A1,LEN(A1)-FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)))

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

    Re: Splitting Competition names

    slightly shorter should work with multiple initials
    =TRIM(UPPER(RIGHT(SUBSTITUTE(TRIM(MID(SUBSTITUTE(A1," v ",REPT(" ",50)),1,40))," ",REPT(" ",40)),20)))&" v "&UPPER(TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",25)),25)))
    "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

  6. #6
    Registered User
    Join Date
    09-04-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Splitting Competition names

    Thankyou all so much..

    I didn't expect so many responses so quickly..

    you have saved me hours of work !!

    cheers

    Alex

  7. #7
    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 Competition names

    This fearsome object seems to work
    =UPPER(RIGHT(LEFT(A2,FIND(" v ",A2,1)-1),LEN(LEFT(A2,FIND(" v ",A2,1)-1))-LOOKUP(LEN(LEFT(A2,FIND(" v ",A2,1)-1)),FIND(" ",LEFT(A2,FIND(" v ",A2,1)-1),ROW(INDEX($A:$A,1,1):INDEX($A:$A,LEN(LEFT(A2,FIND(" v ",A2,1)-1)),1))))))&" v "&UPPER(RIGHT(A2,LEN(A2)-LOOKUP(LEN(A2),FIND(" ",A2,ROW(INDEX($A:$A,1,1):INDEX($A:$A,LEN(A2),1))))))

    It returns
    SMITH v JONES
    NEUMAN v CLOWN
    BEAR v GOLDILOCKS
    HUN v AHAB

    From

    Jack Smith v Peter Jones
    Alfred E. Neuman v Bozo T. Clown
    Papa Bear v Goldilocks
    Atila T. Hun v Captain Ahab

    From one you made earlier Ron
    Last edited by Marcol; 11-16-2010 at 11:13 AM. Reason: Missed the upper case bit
    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.

+ 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