+ Reply to Thread
Results 1 to 11 of 11

Best formula to pull multiple range of data and sort alphabetical

  1. #1
    Forum Contributor
    Join Date
    01-15-2015
    Location
    New York
    MS-Off Ver
    Excel 2011 MAC
    Posts
    104

    Best formula to pull multiple range of data and sort alphabetical

    I was wondering what the best formula is to sort multiple ranges of data, and then sort alphabetical.

    In my example my formula would be in H2 and I'd like it to take all the data from A2:F5, A7:511, A13:F15. Basically excluding row 1, 6 & 12 because they are labels. Then ideally once in H2 I'd like it to sort alphabetically.


    I'd appreciate suggestions. I'd be using this is in both Excel & Google Sheets.

    Screen Shot 2018-09-12 at 7.06.33 PM.png
    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,063

    Re: Best formula to pull multiple range of data and sort alphabetical

    Next time please don't leave us with an area the size of a postage stamp to work with!!!

    This is going to be messy with a single formula...

    1. Remove Group from A2 (on the attached sheet). Headers are now ALL numbers. Names are all text

    2. Formula to return unique list, in H2:
    =IFERROR(INDIRECT(TEXT(AGGREGATE(15,6,(ROW($A$3:$F$17)*100+COLUMN($A:$F))/(($A$3:$F$17<>"")*(ISTEXT($A$3:$F$17))*(COUNTIF($H$1:H1,$A$3:$F$17)=0)),1),"R0C00"),FALSE),"")

    3. ARRAY Formula to sort uniques, in I2:
    =INDEX($H$2:$H$12,MATCH(SMALL(COUNTIF($H$2:$H$12,"<="&$H$2:$H$12),ROWS($I$1:I1)),COUNTIF($H$2:$H$12,"<="&$H$2:$H$12),0))


    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    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 Contributor
    Join Date
    01-15-2015
    Location
    New York
    MS-Off Ver
    Excel 2011 MAC
    Posts
    104

    Re: Best formula to pull multiple range of data and sort alphabetical

    Oh my, I'm so sorry about the sizing / Rows I hide. That was just a force of habit.

    See how in the test data there is two instances of "Person O" but on the sort only 1. Just wondering if it's possible to list both in the sort?

    Thanks for the help

  4. #4
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,223

    Re: Best formula to pull multiple range of data and sort alphabetical

    Firstly remove all group numbers.
    For unique in "H2"
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    For Sorting 'I2"
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    CTRL+SHIFT+ENTER
    See attachment.
    Attached Files Attached Files


    atul


    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".

  5. #5
    Forum Contributor
    Join Date
    01-15-2015
    Location
    New York
    MS-Off Ver
    Excel 2011 MAC
    Posts
    104

    Re: Best formula to pull multiple range of data and sort alphabetical

    I decided to try a different approach in Test1 sheet, seeing which will work best. D2 would grab all the names from A2:C46 and sort alphabetical and if could list each, even if double (Not sure if that's even possible)
    Attached Files Attached Files

  6. #6
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,223

    Re: Best formula to pull multiple range of data and sort alphabetical

    Beh162 : I have attach file, go through as per post #4

  7. #7
    Forum Contributor
    Join Date
    01-15-2015
    Location
    New York
    MS-Off Ver
    Excel 2011 MAC
    Posts
    104

    Re: Best formula to pull multiple range of data and sort alphabetical

    Quote Originally Posted by avk View Post
    Beh162 : I have attach file, go through as per post #4
    Hi, Yes that works wonderful. My only problem is the double "people" I was hoping when they appear twice, they'd also list twice.

  8. #8
    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,063

    Re: Best formula to pull multiple range of data and sort alphabetical

    Most unusual!! 99 times out of 100... a unique list is desired.

    Amend 1st formula to:

    =IFERROR(INDIRECT(TEXT(AGGREGATE(15,6,(ROW($A$3:$F$19)*100+COLUMN($A$3:$F$19))/(ISTEXT($A$3:$F$19))*($A$3:$F$19<>0),ROWS(I$30:I30)),"R0C00"),FALSE),"")
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    01-15-2015
    Location
    New York
    MS-Off Ver
    Excel 2011 MAC
    Posts
    104

    Re: Best formula to pull multiple range of data and sort alphabetical

    It is most unique.

    Can I ask you to just explain to me two things. The meaning of the 15,6 in the formula and also the "R0C00" and the significance of box I30.

    I'm trying to recreate the formula in a bigger test environment and would like to learn a few of those things so I understand where to adjust formula.
    Last edited by Beh162; 09-14-2018 at 07:12 AM.

  10. #10
    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,063

    Re: Best formula to pull multiple range of data and sort alphabetical

    Apols.... Today has been a day on the road, so only getting to this now.

    Not the easiest to explain...

    Ultimately the formula aims to produce a "number" - being a combintation of the row number (R) and the columns number (C), of every cell that meets two criteria.

    1. (ISTEXT($A$3:$F$19)) anything that is text (so excluding the group numbers)

    2. ($A$3:$F$19<>0) - or perhaps easier to follow ($A$3:$F$19<>"") anything that is non-blank.

    So, that selects ONLY those cells that contain TEXT names. The row number is x100 and to that the column number is added.

    So cell A3 (which is Person A), at Row 3, column A (ie the first column.... column 1, if you like) returns 3x100 +1 = 301. Likewise for all the cells that are nonblanks and which contain text (it has just occurred to me that the second parameter ($A$3:$F$19<>"") might be omitted... I will check).

    AGGREGATE(15,6....
    returns them (15) smallest to largest, ignoring errors (6) one at a time, smallest first (I$30:I30) - which is simply a counter resolving to 1, 2, 3, as it is copied down.

    The R0C00 business simply tells excel that you are referring to the cell address in RC notation.

    Clear as mud??

  11. #11
    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,063

    Re: Best formula to pull multiple range of data and sort alphabetical

    ... and yes, the second criterio IS redundant.

    This works perfectly well, too:

    =IFERROR(INDIRECT(TEXT(AGGREGATE(15,6,(ROW($A$3:$F$19)*100+COLUMN($A$3:$F$19))/(ISTEXT($A$3:$F$19)),ROWS(I$30:I30)),"R0C00"),FALSE),"")

+ 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. Non Array Formula to pull unique values and sort in a range
    By bjnockle in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 02-04-2021, 06:15 AM
  2. 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
  3. [SOLVED] sort rows in alphabetical order and move the corresponding data
    By Ken Hudson in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-06-2005, 05:05 PM
  4. [SOLVED] sort rows in alphabetical order and move the corresponding data
    By lianeanddave in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 PM
  5. Replies: 1
    Last Post: 05-05-2005, 07:06 AM
  6. [SOLVED] Preform alphabetical sort without formula in cell changing
    By ace in forum Excel General
    Replies: 1
    Last Post: 04-16-2005, 09:08 AM
  7. [SOLVED] Using a macro to sort your data in alphabetical order?
    By Carrie in forum Excel General
    Replies: 1
    Last Post: 04-14-2005, 11:06 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