Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 347
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract a text string based on character kgiraffa Excel Worksheet Functions 5 March 14th 08 12:54 AM
Excel-Match 1st text character in a string to a known character? bushlite Excel Worksheet Functions 2 January 15th 07 06:36 PM
Reverse Text to Columns MarvInBoise Excel Discussion (Misc queries) 3 September 27th 06 04:50 PM
How do I reverse the row order in Excel, not based on content? Gimbalman Excel Discussion (Misc queries) 2 November 18th 05 05:24 PM
reverse text tom mcdonald Excel Worksheet Functions 5 October 2nd 05 01:04 AM


All times are GMT +1. The time now is 01:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"