![]() |
Name break into half and reverse to upper case
Need to Reverse the name by uppercase and with comma without space afer comma, to below conduction
need to reverse name by half part like below ALL UPPER CASE 1 to 3 words reverse 1 last word 3 to 5 words reverse 2 last word 6 words above reverse 3 last word name EG ( mahesh m.k.l. ) There are 4 words we take space and dot as one word. EG NAME INOUT AND OUTPUT Srinivas SRINIVAS srinivas m M,SRINIVAS srinivas m.j. J,SRINIVAS M. srinivas m.j.h. J.H,SRINIVAS M. srinivas m. j. h. k. H. K,SRINIVAS M. J. srinivas m. j. h. k. l. H. K. L,SRINIVAS M. J. Above are input and out put EG. need to take as it is input with reverse uppercase |
Name break into half and reverse to upper case
Hi,
Am Mon, 29 Oct 2012 10:47:47 +0000 schrieb shrinivasmj: EG NAME INOUT AND OUTPUT Srinivas SRINIVAS srinivas m M,SRINIVAS srinivas m.j. J,SRINIVAS M. srinivas m.j.h. J.H,SRINIVAS M. srinivas m. j. h. k. H. K,SRINIVAS M. J. srinivas m. j. h. k. l. H. K. L,SRINIVAS M. J. try it with VBA (modify to suit): Sub RevStr() Dim c As Range Dim LRow As Long Dim mySearch As Integer Dim Start As Integer LRow = Cells(Rows.Count, 1).End(xlUp).Row For Each c In Range("A1:A" & LRow) If InStr(c, ".") = 0 And InStr(Trim(c), " ") 0 Then mySearch = 2 Else mySearch = Len(c) - Len(Replace(c, ".", "")) + 1 End If Select Case mySearch Case 2 Start = WorksheetFunction.Find(" ", c) + 1 c = Mid(c, Start, 99) & ", " & Left(c, Start - 2) Case 3, 4 c = WorksheetFunction.Substitute(c, ".", "#", 1) Start = WorksheetFunction.Find("#", c) + 1 c = Mid(c, Start, 99) & ", " & Left(c, Start - 2) & "." Case 5, 6, 7, 8, 9, 10 c = WorksheetFunction.Substitute(c, ".", "#", 2) Start = WorksheetFunction.Find("#", c) + 1 c = Mid(c, Start, 99) & ", " & Left(c, Start - 2) & "." End Select c = UCase(Trim(c)) Next End Sub Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
All times are GMT +1. The time now is 08:27 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com