Thanks Thanks:  0
Likes Likes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Reverse numbers and text

  1. #1
    Board Regular
    Join Date
    Apr 2003
    Location
    India
    Posts
    179
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Reverse numbers and text

    How can I reverse ------

    1) A number e.g. 12345 to 54321

    2) A word e.g uttamsaxena to anexasmattu

    3) Small sentence like "This is cat" to "tac si siht"

  2. #2
    Board Regular Brian from Maui's Avatar
    Join Date
    Feb 2002
    Posts
    8,450
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Reverse numbers and text

    Quote Originally Posted by uttamsaxena
    How can I reverse ------

    1) A number e.g. 12345 to 54321

    2) A word e.g uttamsaxena to anexasmattu

    3) Small sentence like "This is cat" to "tac si siht"
    Try ASAP Utilites under TEXT/Reverse text in selected cells.

    www.asap-utilites.com

  3. #3
    MrExcel MVP tusharm's Avatar
    Join Date
    May 2002
    Posts
    11,007
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Reverse numbers and text

    If you have Laurent Longre's outstanding -- and free -- MoreFunc utility (http://longre.free.fr/english/), you can use array formula =MCONCAT(MID(C4,LEN(C4)+1-ROW(INDIRECT("1:"&LEN(C4))),1)) where C4 contains the cell to reverse.

    An array formula is completed not with the ENTER key but with CTRL+SHIFT+ENTER.

  4. #4
    MrExcel MVP Aladin Akyurek's Avatar
    Join Date
    Feb 2002
    Location
    The Hague, NL
    Posts
    84,407
    Post Thanks / Like
    Mentioned
    40 Post(s)
    Tagged
    8 Thread(s)

    Default Re: Reverse numbers and text

    =TEXTREVERSE(A1)

    A function from the morefunc.xll add-in.
    Assuming too much and qualifying too much are two faces of the same problem.

  5. #5
    Board Regular Todd Bardoni's Avatar
    Join Date
    Aug 2002
    Location
    Rochester, MI USA
    Posts
    3,042
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Reverse numbers and text

    I wrote this function:

    Code:
    Function ReverseTxt(ByVal Target As Range)
        myLength = Len(Target.Value)
        For x = 0 To myLength
            ReverseTxt = Left(WorksheetFunction.Substitute(Target.Value, Left(Target.Value, x), ""), 1) & ReverseTxt
        Next x
    End Function
    It seems to work.
    Todd


    "I'm a Data Anlyst(intermediate) and have no idea what it's all about."

  6. #6
    MrExcel MVP tusharm's Avatar
    Join Date
    May 2002
    Posts
    11,007
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Reverse numbers and text

    Interesting...it doesn't appear in my version of Morefunc. I guess I must have a old version of the add-in.
    Quote Originally Posted by Aladin Akyurek
    =TEXTREVERSE(A1)

    A function from the morefunc.xll add-in.

  7. #7
    MrExcel MVP tusharm's Avatar
    Join Date
    May 2002
    Posts
    11,007
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Reverse numbers and text

    If you must write a VBA function, just use VBA's Reverse() function!

    Or if you are coding for VB5, use a loop for i=len(aStr) to 1 step -1 and Mid(aStr,i,1) to extract and concatenate each character. No need for calls on Left(...Substitute(...Left())).
    Quote Originally Posted by tbardoni
    I wrote this function:

    Code:
    Function ReverseTxt(ByVal Target As Range)
        myLength = Len(Target.Value)
        For x = 0 To myLength
            ReverseTxt = Left(WorksheetFunction.Substitute(Target.Value, Left(Target.Value, x), ""), 1) & ReverseTxt
        Next x
    End Function
    It seems to work.

  8. #8
    Board Regular
    Join Date
    Jun 2002
    Location
    Perth, Australia
    Posts
    1,416
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Reverse numbers and text

    The function from the morefunc add-in should be:
    =REVERSETXT(A1)

    not

    =TEXTREVERSE(A1)


    tbardoni,
    It seems to work.
    Worked for everything that I threw at it.

    Just for interest, here’s another UDF from Otto Moehrbach:
    Code:
    Function MyStrReverse(s As String) As String
    Dim i As Long, rslt As String
       For i = Len(s) To 1 Step -1
          rslt = rslt & Mid(s, i, 1)
       Next i
    MyStrReverse = rslt
    End Function
    Regards,


    Mike

  9. #9
    Board Regular Todd Bardoni's Avatar
    Join Date
    Aug 2002
    Location
    Rochester, MI USA
    Posts
    3,042
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Reverse numbers and text

    Ha! You're right, this is a little better
    Code:
    Function ReverseTxt(ByVal Target As Range)
        ReverseTxt = StrReverse(Target.Value)
    End Function
    Todd


    "I'm a Data Anlyst(intermediate) and have no idea what it's all about."

  10. #10
    MrExcel MVP Aladin Akyurek's Avatar
    Join Date
    Feb 2002
    Location
    The Hague, NL
    Posts
    84,407
    Post Thanks / Like
    Mentioned
    40 Post(s)
    Tagged
    8 Thread(s)

    Default Re: Reverse numbers and text

    Quote Originally Posted by Ekim
    The function from the morefunc add-in should be:
    =REVERSETXT(A1)

    not

    =TEXTREVERSE(A1)
    Really? You must have a different version:

    ******** ******************** ************************************************************************>
    Microsoft Excel - Book5___Running: xl2000 : OS = Windows Windows 2000
    (F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)bout
    =

    A
    B
    C
    D
    1
    1234554321
    2
    Sheet1

    [HtmlMaker 2.32] To see the formula in the cells just click on the cells hyperlink or click the Name box
    PLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •