Correct name

shimaa01234

Active Member
Joined
Jun 24, 2014
Messages
446
I have a Group of names I want to correct names
So that the first letter is the last
The last letteris the first letter
Such an example
retepPeter
oarcPMarco
ntefanSStefan

<tbody>
</tbody>
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hi Shiima,

Try this one for the name in A1:
=UPPER(RIGHT(A1,1))&MID(A1,2,LEN(A1)-2)&LEFT(A1,1)
 
Upvote 0
Is second example a mistake ?

Any way
Try this :
=CONCATENATE(RIGHT(A1,1),MID(A1,2,LEN(A1)-2),LEFT(A1,1))
 
Upvote 0
Very wonderful solutions mister "Yesterdays" and Mister "Vidar"
Thank you all
But if the name, such as this
retep oarcM ntefanS
 
Upvote 0
With an UDF (User Defined Function)

Code:
Public Function Mirror(rngCell As Range) As Variant
Mirror = StrReverse(rngCell.Text)
End Function
Result:
<table border='1' cellspacing='0' cellpadding='2' valign='middle' colspan='3' style='font-family:Arial; color:#000000; background-color:#FFFFFF; font-size:10px; font-weight:normal; font-style:normal; '><colgroup><col width='28pt'><col width='60pt'><col width='60pt'></colgroup><tr style='background-color:#cacaca'><td> </td><td align='middle'>A</td><td align='middle'>B</td></tr><tr><td style='background-color:#cacaca' align='middle'>1</td><td align='left' >saxeT</td><td align='left' >Texas</td></tr><tr><td style='background-color:#cacaca' align='middle'>2</td><td align='left' >amabalA</td><td align='left' >Alabama</td></tr><tr><td style='background-color:#cacaca' align='middle'>3</td><td align='left' >awoI</td><td align='left' >Iowa</td></tr><tr><td style='background-color:#cacaca' align='middle'>4</td><td align='left' >eniaM</td><td align='left' >Maine</td></tr></table><br><table border='3' cellspacing='0' cellpadding='2' valign='middle' colspan='2' style='table-layout:auto; color:#000000; background-color:#FFFFFF; font-family:Arial; font-size:10px;'><colgroup><col width='40pt'><col></colgroup><tr style='background-color:#eeaaaa'><td>Cell</td><td>Formula</td></tr><tr><td>B1</td><td><Span style='color:#222222'>=mirror</Span><Span style='color:#0000DD'>(A1)</Span><Span style='color:#222222'></Span></td></tr></table>
 
Last edited:
Upvote 0
With an UDF (User Defined Function)

Code:
Public Function Mirror(rngCell As Range) As Variant
Mirror = StrReverse(rngCell.Text)
End Function
Result:
AB
1saxeTTexas
2amabalAAlabama
3awoIIowa
4eniaMMaine

<colgroup><col style="width: 28ptpx"><col width="60pt"><col width="60pt"></colgroup><tbody>
</tbody>

CellFormula
B1=mirror(A1)

<colgroup><col style="width: 40ptpx"><col></colgroup><tbody>
</tbody>

This just reverse the name, not switching first and last letter of the name
 
Upvote 0
But if the name, such as this
retep oarcM ntefanS
That requires a totally different solution than the question you asked originally. Give this UDF a try...
Code:
Function RevBeginEnd(S As String) As String
  Dim X As Long, Words() As String
  Words = Split(S)
  For X = 0 To UBound(Words)
    Words(X) = Right(Words(X), 1) & Mid(Words(X), 2, Len(Words(X)) - 2) & Left(Words(X), 1)
  Next
  RevBeginEnd = StrConv(Join(Words), vbProperCase)
End Function

HOW TO INSTALL UDFs
------------------------------------
If you are new to UDFs, they are easy to install and use. To install it, simply press ALT+F11 to go into the VB editor and, once there, click Insert/Module on its menu bar, then copy/paste the above code into the code window that just opened up. That's it.... you are done. You can now use RevBeginEnd just like it was a built-in Excel function. For example,

=RevBeginEnd(A1)

If you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.
 
Upvote 0
Hi Shiima,

Try this one for the name in A1:
=UPPER(RIGHT(A1,1))&MID(A1,2,LEN(A1)-2)&LEFT(A1,1)

That doesn't produce Marco nor Stefan. Are you not assuming to much about the specification and the inputs that are given? The inputs and the results the OP expects are reposted below...

oarcP</SPAN>
Marco</SPAN>
ntefanS</SPAN>
Stefan</SPAN>

<TBODY>
</TBODY>
 
Upvote 0

Forum statistics

Threads
1,214,787
Messages
6,121,558
Members
449,038
Latest member
Guest1337

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top