Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to flip the first and last name in cells in Excel?

Let's say you get a roster of names in one column, however, you need to flip the first name and last name in cells. Normally you will get into one cell and cut the last name, and then paste it before the first name, or retype the name again. It will be time-consuming and tedious if you use these traditional methods. Actually, there are several easy ways to flip or reverse the first name and last name in a single column quickly. Supposing you have a column of names, and you need to flip the first and last name as below screenshot shown:
doc flip first last names 1

Flip the first and last name in a column with a function

Flip the first and last name in a column with VBA

Flip the first and last name in a column with Kutools for Excelgood idea3

Split full name into first name and last name with Kutools for Excelgood idea3


reverse text order based on a specific seperator in Excel

The Reverse Text utility of Kutools for Excel can help you reverse the text string based on nothing, space, comma or other seperator, also you can choose to skip non-text cells.
Click for full-featured free trial in 30 days!
doc reverse text
 
Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days.

Flip the first and last name in a column with a function

We can use one of Excel's formulas to flip the first and last name quickly in a column with following steps:

 Enter the formula =MID(A2&" "&A2,FIND(" ",A2)+1,LEN(A2)) in a blank cell, says Cell C2. And then drag the fill handle down to the cells to apply this formula, then you can see all first and last names have been revered. See screenshot:

doc flip first last names 2


Flip the first and last name in a column with VBA

You can also use VBA macros to flip the first and last name in a column quickly.

1. Hold down the Alt + F11 keys in Excel, and it opens the Microsoft Visual Basic for Applications window.

2.  Click Insert > Module, and paste the following macro in the Module window.

Sub FlipName()
'Updateby20131126
Dim Rng As Range
Dim WorkRng As Range
Dim Sign As String
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Sign = Application.InputBox("Symbol interval", xTitleId, " ", Type:=2)
For Each Rng In WorkRng
    xValue = Rng.Value
    NameList = VBA.Split(xValue, Sign)
    If UBound(NameList) = 1 Then
        Rng.Value = NameList(1) + Sign + NameList(0)
    End If
Next
End Sub

3.  Press the F5 key to run this macro. In the popping up KutoolsforExcel dialog box, select the range to flip, and then click the OK button. See screenshot:

doc flip first last names 3

4.  In the following popping up dialog box, please enter an interval symbol (such as a space), and then click the OK button. See screenshot:

doc flip first last names 4

5. Now the first name and last name in selected range are flipped. See screenshot:

doc flip first last names 5


Flip the first and last name in a column with Kutools for Excel

With Kutools for Excel’s Reverse Text Order, you can quickly reverse order of the text in the cells.

Kutools for Excel: A handy Excel add-in tool,makes your jobs more easier and efficiency.
  • 300+ powerful and easy-to-used functions,110,000+ Excel users'choice
  • full-featured free trial in 30 days, no credit card required
  • dozens of one-click functions to shrink your working time on solving complex problems
  • includes functions to batch converion,deletion,combining sheets/cells,exproting, ect, free try now.

After installing Kutools for Excel, please do as below:(Free Download Kutools for Excel Now!)

1.  Select the range that you want to reverse the first and last names.

2.  Click Kutools > Text > Reverse Text Order, see screenshot:

doc flip first last names 8

3.  In the Reverse Text dialog box, specify a separator your selected text string using, (in this case, I select Space option) and then click the OK button. And all the first names and last names in the selected range have been reversed. See screenshot:

doc flip first last names 7

Note: Checking Skip non-text cells to prevent you reversing the numbers in selected range.


Demo: Flip / Reverse the first and last names in cells


Split full name into first name and last name with Kutools for Excel

After installing Kutools for Excel, please do as below:(Free Download Kutools for Excel Now!)

If you have a list of full names which need to split to first name and last name in two columns separately as below screenshot shown, you can apply Kutools for Excel’s Split Names to quickly handle it.
doc flip first last names 9

1. Select the list of names you want to split, click Kutools > Text > Split Names.
doc flip first last names 10

2. In the Split Names dialog, check First name and Last name checkboxes, if you want to split middle name as well, check Middle name. Click Ok, select a cell to place the split names.
doc flip first last names 11



Kutools for Excel: 300 + functions you must have in Excel, 60-day free trial from here.

Tabbed browsing & editing multiple Excel workbooks/Word documents as Firefox, Chrome, Internet Explore 10!

You may be familiar to view multiple webpages in Firefox/Chrome/IE, and switch between them by clicking corresponding tabs easily. Here, Office Tab supports similar processing, which allow you to browse multiple Excel workbooks or Word documents in one Excel window or Word window, and easily switch between them by clicking their tabs. Click for free 30-day trial of Office Tab!

ot excel

Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Miguel · 7 months ago
    =MID(A2&", "&A2,FIND(" ",A2)+1,LEN(A2)+1)

    where the name is on the A2 cell
  • To post as a guest, your comment is unpublished.
    Miguel · 7 months ago
    =MID(O4&", "&O4,FIND(" ",O4)+1,LEN(O4)+1)
  • To post as a guest, your comment is unpublished.
    Mike · 10 months ago
    okay. can someone say this in english because I have no clue what you guys are talking about
  • To post as a guest, your comment is unpublished.
    John · 1 years ago
    Try this to add a comma: =MID(A2&", "&A2,FIND(" ",A2)+1,LEN(A2)+1)
  • To post as a guest, your comment is unpublished.
    Jill · 1 years ago
    What if I need to insert a comma between the last and first name?
  • To post as a guest, your comment is unpublished.
    Ted · 2 years ago
    What if there is a comma separating the 2 names? Is there a way to eliminate it? Now the names look like

    Arthur Lange,

    Eric Norris,

    etc etc

    • To post as a guest, your comment is unpublished.
      Guest · 8 months ago
      Try this to remove a comma: =MID(A2&" "&A2,FIND(", ",A2)+1,LEN(A2)+1)
    • To post as a guest, your comment is unpublished.
      Kody · 2 years ago
      Have you tried Ctrl+F, Select Replace, Find "," and leave replace with blank.
      • To post as a guest, your comment is unpublished.
        Brittany · 1 years ago
        When I try that, it pops up with this error message "There's a problem with this formula. Not trying to type a formula? When the first character is an equal (=) or minus (-) sign, Excel thinks it's a formula: you type: =1+1, cell shows: 2. To get around this, type an apostrophe (') first: you type: '=1+1, cell shows =1+1.
        • To post as a guest, your comment is unpublished.
          Ric · 1 years ago
          I think you are changing the formula. Try copying and pasting the values to a new cell then do the find/replace.
    • To post as a guest, your comment is unpublished.
      Kaity · 2 years ago
      I want to know this too!
  • To post as a guest, your comment is unpublished.
    Danny · 2 years ago
    Correction. What if i have four names? What's the formula?
    Last name - first name - middle1 - middle2
  • To post as a guest, your comment is unpublished.
    Danny · 2 years ago
    If you have middle name how do you flip the last name? Example below.
    Last name - first name - middle name
    • To post as a guest, your comment is unpublished.
      Arev · 2 years ago
      Instead of +1, change the plus factor to two numbers greater than the middle name. This has worked for me.

      Arev
  • To post as a guest, your comment is unpublished.
    Mary · 3 years ago
    THANKS!!!!! This formula just saved me a bunch of time. I am sure I will use it again and again.
  • To post as a guest, your comment is unpublished.
    Jam Smith · 3 years ago
    Please help I need a formula to flip Alexa Victoria G. Garcia to Garcia, Alexa Victoria G.

    Please help :) Thank you
  • To post as a guest, your comment is unpublished.
    Dr. Demento · 4 years ago
    A suggestion - In an effort to encourage good programming practices (Option Explicit), please dim all variables.
  • To post as a guest, your comment is unpublished.
    Raj · 4 years ago
    I would like excel updates
  • To post as a guest, your comment is unpublished.
    Sureshkumar · 4 years ago
    Hello,

    How to reverse the name in the format Lastname,Firstname to Firstname Lastname

    Lets say Paul,John = John Paul
    • To post as a guest, your comment is unpublished.
      Mike Gagne · 4 years ago
      Switching around the last, first is actually a little easier because we have that comma to help us. Assume that the name is in cell A1 and the formula used is:

      TRIM(RIGHT(A1,LEN($A1)-FIND(",",A1,1)))&" "&TRIM(LEFT(A1,FIND(",",A1,1)-1))

      I put the TRIM command on both the first and last names to ensure that we are only going to have the single space between the two. Probably doesn't need the TRIM on the last name, but you never know if a space may be the first character of the cell or if there may be a space preceding the comma.
  • To post as a guest, your comment is unpublished.
    Lea Carol Glennon · 5 years ago
    The first formula worked fine (once I got rid of the middle names). But now I want to alphabetize and it won't do it.......because there's a formula in the cells?
    • To post as a guest, your comment is unpublished.
      heyliddle · 4 years ago
      So there's a long, drawn out way that you can change the format of Lastname, Firstname Middle to Firstname Middlename Lastname.

      Assume that Lastname, Firstname Middle is in Cell A1.

      Highlight the cell/column that Lastname, Firstname Middlename(s) is in. Click Data tab->Text to Columns. Chose "Delimited" Next-> click all that apply in checklist and double click the line between Firstname and Secondname to remove it, Next-> Finish. Now Lastname is still in A1, and Firstname Middlename in B2.

      In a new cell (let's say C1) use the forumla =Concatenate(B1," ",A1) and the name will now read as " Firstname Middlename Lastname" (note the space at the start).

      I another cell (let's say D1) use =TRIM(C1) to remove the space.

      And you're done! I'm sure there is a much easier process, but that's what works for me.

      Cheers!
  • To post as a guest, your comment is unpublished.
    Sciguy · 5 years ago
    Thanks - worked well and saved me a lot of time!
  • To post as a guest, your comment is unpublished.
    DiGi · 5 years ago
    The Macro worked for me. Thanks!
  • To post as a guest, your comment is unpublished.
    vivek · 5 years ago
    I want 20140115 to 15012014
  • To post as a guest, your comment is unpublished.
    CJC · 5 years ago
    I understand what each part of the formula does (MID, FIND, and LEN), but I don't understand why it's actually flipping the names. Can someone please explain that to me?
    • To post as a guest, your comment is unpublished.
      Mike Gagne · 5 years ago
      Sadly, the original formula doesn't work correctly if the name includes a middle initial or middle name. So, "Jim R Green" gets you "R Green Jim" when you really want "Green Jim R".

      The formula to allow for that to happen is:
      =MID(A1&" "&A1,IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))=1,FIND(" ",A1)+1,FIND(" ",A1,FIND(" ",A1)+1)+1),LEN(A1))

      What I've done with the original formula is just add a test to see if the original name contains more than 1 space and if so, begin my mid function with the second space. Note that it's still not perfect because it doesn't take into account "Jr.", "Sr." or "III", etc. being after the last name, but it's better.

      An additional thing to keep in mind is if your data isn't 100% clean and contains leading or trailing spaces, like "Jim R Green ", you'll need to use the TRIM command to clean it up. If you don't, it will throw off the count of spaces and give you a "#value!" error. Use this to ensure no leading or trailing spaces affect your results:

      =MID(TRIM(A1)&" "&TRIM(A1),IF(LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))=1,FIND(" ",TRIM(A1))+1,FIND(" ",TRIM(A1),FIND(" ",TRIM(A1))+1)+1),LEN(TRIM(A1)))

      You can also alter the formula to include the comma between the last and first names, as in "Green, Jim R", by using this:

      =MID(TRIM(A1)&", "&TRIM(A1),IF(LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))=1,FIND(" ",TRIM(A1))+1,FIND(" ",TRIM(A1),FIND(" ",TRIM(A1))+1)+1),LEN(TRIM(A1))+1)

      Hope that helps out some!
      • To post as a guest, your comment is unpublished.
        William · 2 years ago
        [quote name="Mike Gagne"]Sadly, the original formula doesn't work correctly if the name includes a middle initial or middle name. So, "Jim R Green" gets you "R Green Jim" when you really want "Green Jim R".

        The formula to allow for that to happen is:
        =MID(A1&" "&A1,IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))=1,FIND(" ",A1)+1,FIND(" ",A1,FIND(" ",A1)+1)+1),LEN(A1))

        What I've done with the original formula is just add a test to see if the original name contains more than 1 space and if so, begin my mid function with the second space. Note that it's still not perfect because it doesn't take into account "Jr.", "Sr." or "III", etc. being after the last name, but it's better.

        An additional thing to keep in mind is if your data isn't 100% clean and contains leading or trailing spaces, like "Jim R Green ", you'll need to use the TRIM command to clean it up. If you don't, it will throw off the count of spaces and give you a "#value!" error. Use this to ensure no leading or trailing spaces affect your results:

        =MID(TRIM(A1)&" "&TRIM(A1),IF(LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))=1,FIND(" ",TRIM(A1))+1,FIND(" ",TRIM(A1),FIND(" ",TRIM(A1))+1)+1),LEN(TRIM(A1)))

        You can also alter the formula to include the comma between the last and first names, as in "Green, Jim R", by using this:

        =MID(TRIM(A1)&", "&TRIM(A1),IF(LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))=1,FIND(" ",TRIM(A1))+1,FIND(" ",TRIM(A1),FIND(" ",TRIM(A1))+1)+1),LEN(TRIM(A1))+1)

        Hope that helps out some![/quote]

        can you help me with this problem?

        the original
        14D-E13111-00
        and i want it to be
        E13111-14D-00

        Thank you so very much...
      • To post as a guest, your comment is unpublished.
        Prashant Kulkarni · 4 years ago
        Thanks Mike Gagne its helps me lot. i have big data base of full name i have to sort it by last name first. its give me very big help on that work. thank you again.
        :lol:
      • To post as a guest, your comment is unpublished.
        Joel · 5 years ago
        Please help

        What if multiple First name or surname

        Example

        Nick Van Exel
        should appear as VanExel, Nick

        Luis Alfred D. Chua
        should appear as Chua, Luis D.
        Chua, Alfred D.

        Jason D. Lee-Parks
        should appear as LeeParks, Jason D.
      • To post as a guest, your comment is unpublished.
        JS · 5 years ago
        While the original formula doesn't work for multiple first names or first name + middle name initials (the aforementioned Jim R. Green, or Lee Harvey Oswald, for example), it does work correctly for multi-part surnames, e.g. James Van Der Beek -> Van Der Beek James. If you have one or two instances of people with both multiple first names or middle names combined with a multi-part surname, you're probably best off handling those manually. Or trimming away the extra middle names, or saving the first names and last names in separate columns to begin with, then hiding those columns and combining them however you want for display.
        • To post as a guest, your comment is unpublished.
          Mike Gagne · 5 years ago
          That's a really good catch JS, one example that I hadn't thought of testing.

          There is another work around that could be done to help with this issue and that is to use a non-breaking space to separate multi-part last names. You may have seen &NBSP used in HTML code. You can insert a non-breaking space into your cell by holding the ALT key and typing the numbers "0160" using the keypad.

          I tried it and it works great.
    • To post as a guest, your comment is unpublished.
      Mike Gagne · 5 years ago
      [quote name="CJC"]I understand what each part of the formula does (MID, FIND, and LEN), but I don't understand why it's actually flipping the names. Can someone please explain that to me?[/quote]

      Here's the formula being used:
      MID(A1&" "&A1,FIND(" ",A1)+1,LEN(A1))

      The Mid function has these components:
      Mid("text to use", where to start, num of chars to select)

      It works by taking the contents of A1 and putting two copies of it together separated by a space (i.e. A1&" "&A1 = "Jim Green Jim Green".)

      The next step then skips the first word (i.e. Find(" ", A1)+1 = "Jim ", so in net effect leaves you with "Green Jim Green" to work with.)

      The final step selects the length of the orginal string (i.e. Len("Jim Green") = 9) from the remaining portion of the concatenated string less the first name (i.e. "Green Jim Green")

      Hopefully that makes sense.
  • To post as a guest, your comment is unpublished.
    Raymond · 5 years ago
    The first formula works perfectly.
  • To post as a guest, your comment is unpublished.
    Stacy · 5 years ago
    None of this Works, except for what this person is selling