![]() |
reverse text based on a character
i want to change a cell that contains: First name, last name to read last
name, First name |
reverse text based on a character
The following formula will extract and concatenate the data for you:
=RIGHT(A1,LEN(A1)-FIND(",",A1,1)-1)&", "&LEFT(A1,(FIND(",",A1,1)-1)) Changing A1 to match the cell that contains the name. -- Kevin Backmann "george" wrote: i want to change a cell that contains: First name, last name to read last name, First name |
reverse text based on a character
On Tue, 3 Feb 2009 08:45:00 -0800, george
wrote: i want to change a cell that contains: First name, last name to read last name, First name You can do that with a macro: <alt-F11 opens the VB Editor. Ensure your project is highlighted in the Project Explorer window, then Insert/Module and paste the code below into the window that opens. To use this, select a range of cells; then <alt-F8 opens the macro dialog box. Select the macro and <RUN. It will reverse the comma separated string. ====================================== Option Explicit Sub RevNames() Dim c As Range Dim sTemp, sRes() Dim temp Dim i As Long For Each c In Selection If Len(c.Value) 0 Then sTemp = Split(c.Value, ",") ReDim sRes(UBound(sTemp)) For i = UBound(sTemp) To 0 Step -1 sRes(UBound(sTemp) - i) = Trim(sTemp(i)) Next i c.Value = Join(sRes, ", ") End If Next c End Sub ========================== --ron |
All times are GMT +1. The time now is 06:48 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com