+ Reply to Thread
Results 1 to 7 of 7

Extract from table based on criteria, then order results by other criteria

  1. #1
    Registered User
    Join Date
    08-18-2021
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2013
    Posts
    3

    Extract from table based on criteria, then order results by other criteria

    Hi All,

    Sorry for the confusing header name but it's tricky to explain what I'm trying to do with just one line

    Here goes the detailed way of explaining it...

    Let's say I have a list of staff, the days that they work, and the area they work in. I want an extract of that into tables for each area. eg: one for all the Admin people, another for the Backoffice people, etc. Easy so far.

    Each of those tables has a column for each day of the week and a list of all the names that are working that day. So in the Admin table there is a column for Monday with the names of the people that work that day. Ok, little trickier now.

    On top of that, I want to be able to order those names to put people with priority to the top of the list. So in the Admin table there is a column for Monday with the names of the people that work that day, and the person tagged as Priority 1 is at the top of the list. Now we're getting complicated!

    It took me a while but I managed to get the output I want however the formulas are very messy and inelegant. In one cell I have 14 IF statements, 14 CONCATENATEs, and 10 COUNTIFs. Ugh!

    I've attached a sample spreadsheet to this post, with two tabs
    - The first tab is a summary of what I'm trying to achieve, some sample data, and a sample output
    - The second tab is my inelegant (but working) solution

    Appreciate any tips, tricks or suggestions for making this a little more streamlined. Perhaps there are some formulas out there I'm not familiar with, or some way to cut this up for some Pivot tables? I'm open to idea!
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,470

    Re: Extract from table based on criteria, then order results by other criteria

    Welcome to the forum.

    Firstly, your thread title is absolutely fine and explains the issue well. Thank you!

    Secondly, this would be SOOOO much easier if you had MS365 - is your profile accurate (she asks with her fingers and toes crossed)?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    08-18-2021
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2013
    Posts
    3

    Re: Extract from table based on criteria, then order results by other criteria

    Thanks AliGW - both for the welcome and uber-swift response

    Unfortunately I'm still using using 2013, so I'm probably going to have to find an old-school solution.

    You do have me curious though... what would be the 365 solution? Better table/filter tools?

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,470

    Re: Extract from table based on criteria, then order results by other criteria

    The new dynamic array functions such as FILTER, SORTBY, etc. would make it more straightforward. It's still doable without, just perhaps a bit more complex. I have to go - the new worktops for my kitchen have just arrived, so I'm going to be MIA for a couple of hours. Someone else will chip in.

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,367

    Re: Extract from table based on criteria, then order results by other criteria

    Compromise solution:

    Sort the table in "Request" by "Priority"

    In "Sheet1"

    in A1

    Area e,g "Admin" ( i added Data Validation list to demonstrate formula)

    in B3

    =IFERROR(INDEX(Request!$B$11:$B$19&" " &Request!$D$11:$D$19,AGGREGATE(15,6,(ROW($A$11:$A$19)-ROW($A$11)+1)/(Request!$J$11:$J$19=Sheet1!$A$1)/(Request!E$11:E$19="F"),ROWS($1:1))),"")

    Copy across and down
    Attached Files Attached Files
    Last edited by JohnTopley; 08-19-2021 at 09:25 AM.

  6. #6
    Registered User
    Join Date
    08-18-2021
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2013
    Posts
    3

    Re: Extract from table based on criteria, then order results by other criteria

    That's a nice solution, John. A much simpler function though, as you said, it relies on the data being sorted first. My friend isn't exactly Excel savvy and I fear even sorting may be tricky for her but I could probably macro it or something to make it a button press.

    Really appreciate the time you spent on this and your help. Rep added!

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,367

    Re: Extract from table based on criteria, then order results by other criteria

    Thank you for the rep.

    I did think of adding sort macro which could be invoked automatically when the workbook is opened but probably needs a button for changes in data.

+ 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. Replies: 3
    Last Post: 04-18-2021, 03:58 PM
  2. Replies: 40
    Last Post: 08-29-2018, 01:36 PM
  3. [SOLVED] Extract unique limited, number of values based on criteria in ascending order
    By Villalobos in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-03-2017, 04:56 AM
  4. Extract rows from a big table based on criteria in the Same column
    By Madzilla in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-16-2017, 11:39 AM
  5. [SOLVED] Extract names in a list, and present in order, based on qty criteria.
    By TrondG in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 06-23-2016, 08:04 AM
  6. Getting results from a table based on certain criteria
    By gandyling in forum Excel General
    Replies: 7
    Last Post: 02-15-2016, 10:20 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