**Please Note: **
This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, and 2016. 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.

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:

=RIGHT(A1,LEN(A1)-LEN(LEFT(A1,FIND(",",A1) -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, and 2016. You can find a version of this tip for the older menu interface of Excel here: **Reordering Last Name and First Name**.

**Create Custom Apps with VBA!** Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out *Mastering VBA for Office 2013* today!

When working with data in Excel, you might want to figure out which rows of data represent duplicates of other rows. If ...

Discover MoreIf you define your named ranges after you create your formulas, you can have Excel update those formulas to reflect the ...

Discover MoreWhen you enter a formula in a cell, you expect Excel to display the result of that formula once you are completed. If ...

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

2018-01-01 03:43:26

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.. :-)

Alan

2017-12-31 11:27:09

Rick Rothstein

>>

>>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

see you in 2018

2017-12-29 12:22:46

Willy Vanhaelen

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.

Willy

2017-12-25 05:47:07

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..

Alan

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

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

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

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

2016-12-10 09:29:00

Willy Vanhaelen

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

2016-03-31 08:05:21

Dim myArry() as string

myArry=split ("A1",",")

A1=myArry(1) & "," & myArry(0)

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.

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

Copyright © 2020 Sharon Parq Associates, Inc.

## Comments