EXCEL FORMULAS

  • Thread starter Thread starter MICHAEL KENT
  • Start date Start date
M

MICHAEL KENT

This might be an incredibly easy solution to my problem,
but I cannot think of it !!
I have a list of employees which is set out in the format
of first name, then surname e.g. John Smith.
I want to turn that around to read Smith John - is there a
way of doing this ??

Thanks !!
 
Hi Michael!

One way is to set up a new column and use the formula:

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

Then use Copy > Paste Special > Values on the new column and delete
the old one.


--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
 
If the list of names is one string "John Smith" Then you need to first "split" the name, pulling first and last name into each strFirst and strLast, then reconstruct the string with strLast + " " + strFirst. Of course that will not work well if there are other punctuation marks in the string or if there is a middle initial.

So you can do a find on the original text for a space (" ") this result will give you a number, the number represents how many characters into the string the space is. This number can also be used to get that number of LEFT characters which would be stored as the strLast name. The total number of characters in the string, minus the number returned by the find would give you the RIGHT part of the string to be stored as strFirst. I know it's not VB code, but this pseudo code should get you going.
 
If the data is consistant, then Menu-Data/Text to
columns/Delimted(Character, such as
commas....)/Next/Space/Next/Finish
 
Back
Top