+ Reply to Thread
Results 1 to 7 of 7

Array formula to return table column values, alpha sorted

  1. #1
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Ky
    MS-Off Ver
    Excel 2013
    Posts
    344

    Array formula to return table column values, alpha sorted

    I'm have a table, 'EmpTable,' which contains employee names in column B, '[Employee]', and a named range of EmpList, which =EmpTable[Employee]. The table has headers so the first name appears on B2. But the table needs sorted by another column criteria, so the names are not alphabetical in the table, which I also need.

    In trying to get a list of the names alpha-sorted that will update when changes are made to the table, and I have the following all array formula on another sheet (beginning on A2 of that sheet):

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This works great except it leaves off the last (alpha) name from the list! For example, the table has 288 names, but the formula, copied down to row 300, returns 287 names, and the 1 left off is the last name by the alpha-sort.

  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
    43,986

    Re: Array formula to return table column values, alpha sorted

    Use this array formula:

    =IFERROR(INDEX(Emplist,MATCH(0,COUNTIF(Emplist,"<"&Emplist)-SUM(COUNTIF(Emplist,"="&C$1:C1)),0)),"")

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Attached Files Attached Files
    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 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
    43,986

    Re: Array formula to return table column values, alpha sorted

    If, by any chance there are duplicate names in Emplist, my formula will return only unique names. So, if you have two John Doe, my formula will return only one of them. This one will return BOTH:

    =IFERROR(INDEX(Emplist,MATCH(SMALL(COUNTIF(Emplist,"<"&Emplist),ROWS($D$2:D2)),COUNTIF(Emplist,"<"&Emplist),0)),"")

    it's also an array formula.

  4. #4
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Ky
    MS-Off Ver
    Excel 2013
    Posts
    344

    Re: Array formula to return table column values, alpha sorted

    As it turns out, my array formula (it was an array too, I know all about them, btw), should've been =IF(COUNTA(EmpList)>=+ROWS($B$2:B2) in the first portion, instead of only =...(EmpList)>+ROWS... so mine is actually working correctly now, I just forgot to post it.

    But yours works too! Thank you!!

  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
    43,986

    Re: Array formula to return table column values, alpha sorted

    I rarely look at formulae that "don't work". It can be very misleading. It's easier to start from scratch. But glad you were able to figure it out!

  6. #6
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Ky
    MS-Off Ver
    Excel 2013
    Posts
    344

    Re: Array formula to return table column values, alpha sorted

    Yes, now, just for fun, I'm looking at the difference between the 2... mine uses COUNTA, ROWS, INDEX, MATCH, SMALL, COUNTIF (twice) and ROW... while your first one uses IFERROR, INDEX, MATCH, COUNTIF (twice) and SUM. What I'm wondering is if - since yours is shorter and uses less functions - if it's marginally quicker or more stable?

  7. #7
    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
    43,986

    Re: Array formula to return table column values, alpha sorted

    Select row 1. Insert a few rows. That should answer your Q as to which is more stable.

+ 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. Return Multiple Text Reslts Sorted Based Unique Values in another Column
    By Fin Fang Foom in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-10-2015, 12:01 AM
  2. [SOLVED] need formula of vlookup through lookup value of table array contains alpha numeric
    By johnlara in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-30-2015, 10:47 AM
  3. Array Formula To Return Unique Values From a Column Using a Value
    By lucas813 in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 02-13-2015, 12:07 PM
  4. Replies: 6
    Last Post: 12-11-2013, 05:57 AM
  5. [SOLVED] How to make a sorted list Column by Column using array formula
    By turist in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-09-2013, 11:11 AM
  6. Replies: 1
    Last Post: 01-14-2013, 05:55 PM
  7. [SOLVED] Formula to only return a number value in a column with mixed Alpha and Numeric values
    By AusVivienne in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-05-2012, 03:17 AM

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