1. Welcome to Chandoo.org Forums. Short message for you

    Hi Guest,

    Thanks for joining Chandoo.org forums. We are here to make you awesome in Excel. Before you post your first question, please read this short introduction guide. When posting or responding to questions please remember our values at Chandoo.org are: Humility, Passion, Fun, Awesomeness, Simplicity, Sharing Remember that we have people here for whom English is not there first language and we need to allow for this in our dealings.

    Yours,
    Chandoo
  2. Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  3. When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Sort words from the end

Discussion in 'Ask an Excel Question' started by Pampos, Aug 11, 2017.

  1. Pampos

    Pampos New Member

    Messages:
    23
    Hello. I want, for example, to sort

    big house
    small tree
    red cat
    green house

    alphabetically but start from the last letter.

    For example, the result must be

    small tree
    big house
    green house
    red cat

    Is that possible with excel? I already tried =RIGHT(A1,1) but is doesn't help me for the purpose I want the sorting.

    Do you know if it is easier to do that in word?

    Thanks
  2. NARAYANK991

    NARAYANK991 Excel Ninja

    Messages:
    15,636
    Hi ,

    It is easy if you use VBA ; is that an option ?

    If yes , then see the attached file.

    Narayan

    Attached Files:

  3. p45cal

    p45cal Well-Known Member

    Messages:
    828
    You can add a user-defined function such as Reverse which will take your strings and reverse them. Then you can sort on that new column. See attached which has such a function but I have left it unsorted, ready for you to do a standard sort on column B.
    Before:
    upload_2017-8-11_14-44-52.png

    After:
    upload_2017-8-11_14-45-59.png

    And the code for that function:
    Code (vb):
    Function Reverse(TheString)
    For i = Len(TheString) To 1 Step -1
      Reverse = Reverse & Mid(TheString, i, 1)
    Next i
    End Function

    Attached Files:

  4. Pampos

    Pampos New Member

    Messages:
    23
    Many thanks. REVERSETEXT is working as I want to.
  5. p45cal

    p45cal Well-Known Member

    Messages:
    828
    I positively knew there was a shorter UDF I could write when I put forward my offering earlier. Here it is:
    Code (vb):
    Function Reverse(TheString)
    Reverse = StrReverse(TheString)
    End Function
    NARAYANK991 likes this.

Share This Page