Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
reverse text based on a character
i want to change a cell that contains: First name, last name to read last
name, First name |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Extract a text string based on character | Excel Worksheet Functions | |||
Excel-Match 1st text character in a string to a known character? | Excel Worksheet Functions | |||
Reverse Text to Columns | Excel Discussion (Misc queries) | |||
How do I reverse the row order in Excel, not based on content? | Excel Discussion (Misc queries) | |||
reverse text | Excel Worksheet Functions |