Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Reordering Last Name and First Name.

Reordering Last Name and First Name

by Allen Wyatt
(last updated July 30, 2020)


You may have a worksheet containing many cells with names that are in LastName, FirstName MI format. A common example of this would be an Excel worksheet designed to work as an expense account reporting form. You may want to convert these employee names into standard format, i.e. FirstName MI LastName. Performing this operation on more than a handful of cells can become quite cumbersome.

To make the conversion job easier, you can use a handy formula that rearranges the parts of the name for you. Assume that cell A1 contains the name Doe, Jane Q. and you want the conversion (Jane Q. Doe) to appear in cell B1. Place the following formula in B1:

-1))-2) & " " & LEFT(A1,FIND(",",A1)-1)

The formula works by breaking the string based on the placement of the comma. The formula will also work with suffixes and multiple middle initials as long as there is one and only one comma present in the source cell.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12042) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. You can find a version of this tip for the older menu interface of Excel here: Reordering Last Name and First Name.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...


Entering Tabs in a Table

When press the Tab key while entering info into a table, Word dutifully moves to the next table cell. If you don't want ...

Discover More

Deleting an Old Document Version

Word allows you to maintain different versions of the same document all within a single document file. Here's how to ...

Discover More

TOC Heading Numbers Always Show in Bold

Linda's got a document that includes a table of contents that is based on headings in the document. When the headings ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (ribbon)

Separating Names into Individual Columns

If you have a list of names in a column, and you want to separate those names into individual cells, there are several ...

Discover More

Counting Unique Values

Need to know a count of unique values in a range of cells? There are a couple of ways you can tackle the problem.

Discover More

Summing Every Fourth Cell in a Row

Need to sum a series of cells that fits some regular pattern? Here are several ways that you can get the summation that ...

Discover More

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 + 7?

2021-01-28 16:09:46


doesn't go

2018-01-01 03:43:26

Alan Elston

Thanks Rick
I see also that the address substitution is not necessary, when I know the address. But I found that @ substitution from an earlier post of yours quite neat so I left it in to remind me.
I must also note that when inside a function nested in a [ ] then quotes are possible. I have probably overlooked that in the past. I have probably overlooked that as a major advantage of the Evaluate(“ “) over the “shorthand” [ ] is often given as being able to …..“…build up a string, whereas you cannot do that with the [ ] …”...
In fact now that I recall, I think I noticed in a post of yours before .. and noted then the less tricky building up of the quotes in the [ ] compared with in the Evaluate(” “)
( – I was away all Summer from the computer so must brush up a bit :) )_ ….
For a [ ] you put in it what you put in a cell
For a Evaluate(“ “) you have to arrange that the evaluated string ends up looking like what you have in a cell … that can be a nightmare then with double - doubled - """" - """" & :- ) quotes and the such.. :-)


2017-12-31 11:27:09

Rick Rothstein

>> Now apply that one liner code in this form:
>>Sub RangeEvaluate()
>> Let Range("B20:B25").Value = Evaluate(Replace("IF({1},TRIM(MID(@&"" ""&@,FIND("","",@)+1,LEN(@))))", "@", Range("A20:A25").Address))
>>End Sub

Alan... if the ranges are fixed and non-changing, then your one-liner can be "simplified" by using the alternative syntax for the Evaluate function.

Sub RangeEvaluate()
[B20:B25] = [IF({1},TRIM(MID(A20:A25&" "&A20:A25,FIND(",",A20:A25)+1,LEN(A20:A25))))]
End Sub

2017-12-30 03:01:48

Alan Elston

...."...Excel array formula in disguise..."... That is a nice description, Wiily, I like that :-)
see you in 2018

2017-12-29 12:22:46

Willy Vanhaelen

@Alan Elston
It can even simpler: just select the range and run my one liner, it will process all cells in the selected range at once. So you can use it on a single cell or with any range without having to change it. And you are right this one liner runs much faster than a macro using a loop. In fact it is a sort of Excel array formula "in disguise" :-)

I wish you the best for 2018.


2017-12-25 05:47:07

Alan Elston

Just for anyone that may not have noticed.. The beauty of that Evaluate Range type one liner is that it works over a Range of more than one cell, ( and often it works a lot quicker than a more typically seen code which would loop through that range applying at each loop a formula ).

So, as example, say the cells A20 to A25 look something like this:
Doe, Jane Q
Elston,Alan M
Rothstein, Rick
Elstein,Doc. Alaen
Halen,Wolfgang Van
Vanhaelen, Willy

Now apply that one liner code in this form:

Sub RangeEvaluate()
Let Range("B20:B25").Value = Evaluate(Replace("IF({1},TRIM(MID(@&"" ""&@,FIND("","",@)+1,LEN(@))))", "@", Range("A20:A25").Address))
End Sub

You should then see over the range B20 to B25
Jane Q Doe
Alan M Elston
Rick Rothstein
Doc. Alaen Elstein
Wolfgang Van Halen
Willy Vanhaelen

Merry Xmas Willy and Rick, and best wishes for the New Year..

2017-12-25 02:31:20

Rick Rothstein


And here is a one-liner UDF (user defined function) should anyone want to go that route...

Function Reorder(S As String) As String
Reorder = Trim(Mid(S & " " & S, InStr(S, ",") + 1, Len(S)))
End Function

2017-12-24 13:51:22

Willy Vanhaelen

@Rick Rothstein

Brillant !

Here is even a one-liner based on your formula :-)

Sub Reorder()
Selection = Evaluate(Replace("IF({1},TRIM(MID(@&"" ""&@,FIND("","",@)+1,LEN(@))))", "@", Selection.Address))
End Sub

2017-12-23 05:31:16

Rick Rothstein

@ Willy Vanhaelen and Sara Gonzalez,

Here is a shorter formula that will work whether there is a space after the comma or not...

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

2017-12-23 05:26:42

Rick Rothstein

Here is a shorter formula which will produce the same results as the one shown in this article...

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

2016-12-10 09:29:00

Willy Vanhaelen

@Sara Gonzalez

This shorter formula will do the job whether or not there is a space after the comma.

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

2016-12-09 14:21:47

Sara Gonzalez

What if my text isn't seperated by a space after the comma. For example our program generates the name as follows last,first with no space between the comma and first name. So when I use this formula it chops it up. So I would have to manually enter the space in order for the formula to work. Any quick fixes.

2016-03-31 08:05:21


This seems much simpler to me;
Dim myArry() as string
myArry=split ("A1",",")
A1=myArry(1) & "," & myArry(0)

This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.