+ Reply to Thread
Results 1 to 4 of 4

Sort by text length

  1. #1
    Registered User
    Join Date
    05-01-2006
    Posts
    12

    Sort by text length

    Is there an easy way to sort a column's values by text length?

    For example:

    COLUMN A
    eat
    shoes
    lies
    french fries
    california

    would become:
    eat
    lies
    shoes
    california
    french fries

    Does someone have a macro that already does this?

    Thanks in advance for your help and time!!

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887
    Well, the "easy" way would be to add a column next to this column of values, and in the new column put the formula (assuming your data is in column A):

    =len(a1)

    Fill that down as many rows as needed, then select your data and sort by your LEN column. Once it's sorted you can then delete the column of formulas (or hide it if you think you might need it later).

    If you need to run this more than a handful of times, then a macro will be easiest in the long run so you can just press a button and watch it go. I'll defer to others with more vba experience than myself for that part.

  3. #3
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good morning holyearth

    If you need to run this more than a handful of times, then a macro will be easiest in the long run so you can just press a button and watch it go. I'll defer to others with more vba experience than myself for that part.
    For a ready made solution download and install my add-in from the link below, and go to Ultimate > Range > Sort Range Utility, and select "String length".

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  4. #4
    Registered User
    Join Date
    05-01-2006
    Posts
    12
    pjoaquin and dominicb thanks for your help!

    Much appreciated!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1