i am having names in COL -A
all begining with intials followed by the name
and some names without initials as under:
M.GUPTA
C.K.S.BANERJEE
RAMAN
M.M.K.S.MOHAN
L.T.PRABA
S.LAL
and so on..!
what i want is to rearrange
the names to begin with the name
followed by initials..like
GUPTA.M.
BANERJEE.C.K.S.
RAMAN
MOHAN.M.M.K.S.
PRABA.L.T.
LAL.S.
so that it would be easier for
sorting the names..!
any help please?
-via135
=IF(ISNUMBER(FIND(".",A1)),SUBSTITUTE(A1,".","^",LEN(A1)-LEN(SUBSTITUTE(A1,".",""))),A1)
and then in C1:Cxx use:
=IF(ISNUMBER(FIND("^",B1)),MID(B1,FIND("^",B1)+1,255)&"."&SUBSTITUTE(LEFT(B1,FIND("^",B1)),"^","."),B1)
You could then copy the final values in column C and use PasteSpecial
over the values in column A. Then delete columns B & C.
You could also use VBA, and without having coded it the InStrRev method
might work quite well.
--
Paul
- Paul
------------------------------------------------------------------------
Paul's Profile: 1697
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=192696
=MID(A1&"."&A1,LEN(A1)-LEN(TRIM(RIGHT(SUBSTITUTE(A1,".",REPT("
",99)),99)))+1,LEN(A1))
--
Rick (MVP - Excel)
"via135" <via...@gmail.com> wrote in message
news:42995b4a-43db-4bca...@k13g2000yqe.googlegroups.com...
=LEFT(TRIM(RIGHT(SUBSTITUTE(A1,".",REPT("
",99)),99))&"."&A1,LEN(A1)+(COUNTIF(A1,"*.*")>0))
"via135" wrote:
> .
>
hello Teethless mama..!
i am getting the result like this...
M
C
R
M
L
S
hi Rothstein.!
i am getting the results like....
.GUPTA.
.S.BANERJEE.C.
RAMAN
K.S.MOHAN.M.M
T.PRABA.L
.LAL.
--
Rick (MVP - Excel)
"via135" <via...@gmail.com> wrote in message
news:701ce179-0acb-4324...@i25g2000yqm.googlegroups.com...
"Rick Rothstein" wrote:
> .
>
????
That is not the case on any of the tests I've performed here. I do note that
the trailing "dot" is missing though. Try this formula and make sure you
don't have a trailing blank space after the name...
=MID(A1&"."&A1,LEN(A1)-LEN(TRIM(RIGHT(SUBSTITUTE(A1,".",REPT("
",99)),99)))+1,LEN(A1)+1)
=MID(A1&"."&A1,LEN(A1)-LEN(TRIM(RIGHT(SUBSTITUTE(A1,".",
REPT(" ",99)),99)))+1,LEN(A1)+(NOT(ISERR(FIND(".",A1)))))
--
Rick (MVP - Excel)
"Rick Rothstein" <rick.new...@NO.SPAMverizon.net> wrote in message
news:OKwHl#10KHA...@TK2MSFTNGP05.phx.gbl...
=MID(A1&"."&A1,LEN(A1)-LEN(TRIM(RIGHT(SUBSTITUTE(A1,".",
REPT(" ",99)),99)))+1,LEN(A1)+(NOT(ISERR(FIND(".",A1)))))
--
Rick (MVP - Excel)
"Rick Rothstein" <rick.new...@NO.SPAMverizon.net> wrote in message
news:ug70bO2...@TK2MSFTNGP04.phx.gbl...
This is from copying the "original" data from the webpage and pasting
it into Excel (no hidden spacing exists, etc). If you're not getting
the same results, your data has to be different in some way than what
you're providing in your original post. (hidden characters, carriage
returns, etc.)
--
Rick (MVP - Excel)
"Paul" <Paul....@thecodecage.com> wrote in message
news:Paul....@thecodecage.com...
Code:
--------------------
Sub organize()
Dim i As Long, j As Long
For i = 1 To Range("A" & Rows.Count).End(xlUp).Row
j = InStrRev(Cells(i, 1).Value, ".")
If j > 0 Then
Cells(i, 1).Value = Mid(Cells(i, 1).Value, j + 1, 255) & _
"." & Left(Cells(i, 1).Value, j)
End If
Next i
End Sub
--------------------
Assumes values are in A1:Axx. Paste this code into the worksheet
module with your data (ALT+F11 to open VB Editor).
yes..
=MID(A1&"."&A1,LEN(A1)-LEN(TRIM(RIGHT(SUBSTITUTE(A1,".",
REPT(" ",99)),99)))+1,LEN(A1)+(NOT(ISERR(FIND(".",A1)))))
this one works fine..!
thks Rothstein for fixing up the problem..! thks again
-via135
thks Paul..!
the macro also works like a charm..!
-via135