+ Reply to Thread
Results 1 to 11 of 11

Automatically Sort Data in Alphabetical Order using Formula (Array and Non-Array Formula)

  1. #1
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Automatically Sort Data in Alphabetical Order using Formula (Array and Non-Array Formula)

    Looking for formula (Array and Non-Array Formula welcome) to automatically sort data in alphabetical order. See sample file. Thanks.
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Automatically Sort Data in Alphabetical Order using Formula (Array and Non-Array Formu

    One way:

    =LOOKUP(1,0/FREQUENCY(ROWS(B$1:B1),COUNTIF($A$2:$A$5,"<="&$A$2:$A$5)),$A$2:$A$5)&""
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Automatically Sort Data in Alphabetical Order using Formula (Array and Non-Array Formu

    Easiest way, add Sort index using following formula.
    =COUNTIF($A$2:$A$5,"<="&A2)

    Then use Index,Match. To return based on sort index.

    If using Office 365, use SORT() function.

    Alternately...
    Edit: Use Glenn's formula. Much more efficient. Mine was only looking at left most char.
    Copy down.
    Last edited by CK76; 10-26-2020 at 11:44 AM.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  4. #4
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Automatically Sort Data in Alphabetical Order using Formula (Array and Non-Array Formu

    Glenn Kennedy: when I changed the rows from
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    or when I changed the rows to cover 21 rows, it is not displaying the correct answer. See attached file.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Automatically Sort Data in Alphabetical Order using Formula (Array and Non-Array Formu

    It doesn't like blanks... The best way to overcome this is to use a Named Range to auto-adjust the ranges. In your rela sheet, will column A be data, or the product of a formula? Will it be text or a number?

  6. #6
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Automatically Sort Data in Alphabetical Order using Formula (Array and Non-Array Formu

    Please try at B2

    =LOOKUP(1,0/FREQUENCY(COUNTBLANK($A$2:$A$21)+ROWS(B$2:B2),1/(1/COUNTIFS($A$2:$A$21,"<="&$A$2:$A$21))),$A$2:$A$21)
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Automatically Sort Data in Alphabetical Order using Formula (Array and Non-Array Formu

    CK76:
    Easiest way, add Sort index using following formula. - I have tried this helper column approach. However, it is not displaying the desired results the way I would like it displayed. Sorted values are pushed to the bottom of the list. See attached file to see issue with approach.

    =COUNTIF($A$2:$A$5,"<="&A2)
    Attached Files Attached Files

  8. #8
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Automatically Sort Data in Alphabetical Order using Formula (Array and Non-Array Formu

    You need to exclude blanks.

    Ex:
    =IF(A2="","",COUNTIFS($A$2:$A$21,"<="&A2))

    Then in C2:
    =IFERROR(INDEX($A$2:$A$21,MATCH(SMALL($B$2:$B$21,ROWS($A$1:A1)),$B$2:$B$21,0)),"")

    See attached.
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Automatically Sort Data in Alphabetical Order using Formula (Array and Non-Array Formu

    CK76: works like a charm. Thanks a lot.

  10. #10
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Automatically Sort Data in Alphabetical Order using Formula (Array and Non-Array Formu

    Bo_Ry: excellent solution. Thanks a lot.

  11. #11
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Automatically Sort Data in Alphabetical Order using Formula (Array and Non-Array Formu

    Glenn Kennedy: Thanks a lot for your proposed solution. I did not really clear things up for you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Automatically Sort Data in Alphabetical Order using Formula
    By garashidi in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-09-2020, 10:36 PM
  2. Non-Array formula to Remove Duplicates and Sort in Ascending Order
    By bjnockle in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-17-2018, 02:59 PM
  3. Sort array formula results in descending order
    By OLLY-7 in forum Excel General
    Replies: 8
    Last Post: 12-19-2016, 02:47 PM
  4. Sorting an array of strings into alphabetical order
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 02-05-2015, 01:29 AM
  5. Pull Unique Values from a List and Automatically Sort in Alphabetical Order
    By Aimee S. in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-29-2013, 09:43 AM
  6. Sort data using array formula
    By mukeshbaviskar in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-15-2013, 06:36 PM
  7. Replies: 1
    Last Post: 03-09-2006, 01:24 PM

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