+ Reply to Thread
Results 1 to 4 of 4

Formula to reverse two sets of names in same cell

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-16-2010
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    161

    Formula to reverse two sets of names in same cell

    Hi

    I wonder if someone could assist with a formula to reverse two sets of names in a cell please.
    Scenario
    I have been sent a large set of data where the names are like this

    Smith Fred - Hunt George

    I would like to change it to

    Fred Smith/George Hunt

    I've used =MID(A1&" "&A1,FIND(" ",A1)+1,LEN(A1)) before to reverse two names, but this goes beyond.

    I'm not too worried about anomalies that might occur, I can manually edit them (where a middle name is introduced or a Jr or Sr is added)

    Thanks for your thoughts
    Neil

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,810

    Re: Formula to reverse two sets of names in same cell

    Using "helper" columns with initial data in A1

    in B1 =TRIM(MID(A1,1,FIND("-",A1)-2))

    in C1 =TRIM(MID(A1,FIND("- ",A1)+2,255))

    in D1 =MID(B1&" "&B1,FIND(" ",B1)+1,LEN(B1)) & "/" & MID(C1&" "&C1,FIND(" ",C1)+1,LEN(C1))

    Hope this helps.

  3. #3
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: Formula to reverse two sets of names in same cell

    Or another approach (if this is repeating task - could be done with macro).
    If there is a hyphen between the two I'd do the following:
    mark whole column do text to columns, separated and hyphen as the separation mark
    then insert few (or more if there are names like Juan Carlos I Alfonso Víctor María de Borbón y Borbón-Dos Sicilias ) columns in between and again do text to columns on both subsets (now marking space as separator

    and now final formula (somewhere in X1) would be like
    Formula: copy to clipboard
    = K1 & " " & J1 & " - " & B1 & " " & A1
    or similar
    Best Regards,

    Kaper

  4. #4
    Forum Contributor
    Join Date
    06-16-2010
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    161

    Re: Formula to reverse two sets of names in same cell

    Thanks both, I like both approaches and will test later to see which is easiest to implement.

    Neil

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Reverse Sum formula in a cell with a Macro to make column consistent...
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-07-2015, 03:29 PM
  2. Reverse Last and First Names
    By vicstone in forum Excel General
    Replies: 5
    Last Post: 07-18-2011, 10:54 AM
  3. combining 2 sets of data, deleting uncommon names
    By annelayton in forum Excel General
    Replies: 18
    Last Post: 12-19-2010, 03:07 AM
  4. Reverse Data In A Cell / Reverse Cell Contents
    By nostawydoc in forum Excel General
    Replies: 5
    Last Post: 12-18-2009, 05:20 PM
  5. Reverse names and deleting common occurence.
    By Yappa in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-15-2008, 12:49 PM
  6. Replies: 5
    Last Post: 02-20-2005, 08:06 PM
  7. [SOLVED] Using Vlookup to look at different names sets of data....
    By Sepp! in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-31-2005, 04:38 PM

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