+ Reply to Thread
Results 1 to 11 of 11

Index or Lookup function based on 2 drop down list to extract data from one sheet to anoth

  1. #1
    Registered User
    Join Date
    07-21-2016
    Location
    London
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2302 Build 16.0.16130.20806) 64-bit
    Posts
    94

    Index or Lookup function based on 2 drop down list to extract data from one sheet to anoth

    Hi There,

    I am have a problem with a report I'm trying to compile. I have a data set (sample Tab) that has a range of Client names with metrics against it. I want to bring over the Clients into a template (Summary tab) i have when it matches multiple criterias. These Criterias consists of drop downs and labels (highlighted in Yellow). I have tried using index match, but it's not bringing back what I need. the Drop down has list of Services and Channels that matches a column in the data set. I also have a selection in the dropdowns that says "All", which should bring all Clients in the data set, but when a specific service and Channel a picked the list should only show the Clients and figures that matches those criteria.

    Please can you help.

    Many 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,052

    Re: Index or Lookup function based on 2 drop down list to extract data from one sheet to a

    You could use variants of this array formula:

    =IFERROR(INDEX(Sample!$B:$B,SMALL(IF(Sample!$D$2:$D$19=IF($A$2="All",Sample!$D$2:$D$19,$A$2),IF(Sample!$G$2:$G$19=IF($A$3="All",Sample!$G$2:$G$19,$A$3),IF(Sample!$E$2:$E$19=$A$5,ROW(Sample!$D$2:$D$19)))),ROWS(A$7:A7))),"")

    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
    Registered User
    Join Date
    07-21-2016
    Location
    London
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2302 Build 16.0.16130.20806) 64-bit
    Posts
    94

    Re: Index or Lookup function based on 2 drop down list to extract data from one sheet to a

    THIS IS PERFECT!!!!!!! thanks Glenn

  4. #4
    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,052

    Re: Index or Lookup function based on 2 drop down list to extract data from one sheet to a

    You're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

  5. #5
    Registered User
    Join Date
    07-21-2016
    Location
    London
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2302 Build 16.0.16130.20806) 64-bit
    Posts
    94

    Re: Index or Lookup function based on 2 drop down list to extract data from one sheet to a

    Hi Glenn,

    The array you've provided me, works like a charm, but for some reason it has slowed down the entire workbook. Is there an alternative please??

    Many thanks
    F

  6. #6
    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,052

    Re: Index or Lookup function based on 2 drop down list to extract data from one sheet to a

    Array formulae can be slow. Especially when you are flinging a lot of work at it (the two "all") options in your dropdowns. Two suggestions.

    1. Do not use excessively long ranges in the formulae. Don't set ranges to cover 10,000 rows if you only have 500.

    You could also try this formula (it's non-array and a replacement for the formula originally in A7:

    =IFERROR(INDEX(Sample!$B:$B,AGGREGATE(15,6,ROW(Sample!$D$2:$D$19)/((Sample!$D$2:$D$19=IF($A$2="All",Sample!$D$2:$D$19,$A$2))*(Sample!$G$2:$G$19=IF($A$3="All",Sample!$G$2:$G$19,$A$3))*(Sample!$E$2:$E$19=$A$5)),ROWS(A$7:A7))),"")

    I have modified the HBP Table. Is the other one REALLY needed? Why not have another DD in A5 with the two options?
    Attached Files Attached Files

  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
    44,052

    Re: Index or Lookup function based on 2 drop down list to extract data from one sheet to a

    I have just checked the speed of the two formulae. They are not so very different. the non-array formula is only about 10% faster. So, maybe no great advantage in speed. So, in your real data are you using unrealistic ranges? Do you have a lot of volatile functions in the sheet (OFFSET, INDIRECT, TODAY(), etc), or array formulae and SUMPRODUCT formulae with whole column ranges?

    The original formula and the modified formulae were run on each of the 14 output cells, 16,000 times, a total of about 230,000 calculations on each formula. Both formulae (array and non array) completed the task in approximately 3 seconds.
    Last edited by Glenn Kennedy; 03-19-2018 at 12:00 PM.

  8. #8
    Registered User
    Join Date
    07-21-2016
    Location
    London
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2302 Build 16.0.16130.20806) 64-bit
    Posts
    94

    Re: Index or Lookup function based on 2 drop down list to extract data from one sheet to a

    Thanks Glenn,

    Let me see if It works faster if I reduce the cell range, I have to admit I did use a longer range.

  9. #9
    Registered User
    Join Date
    07-21-2016
    Location
    London
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2302 Build 16.0.16130.20806) 64-bit
    Posts
    94

    Re: Index or Lookup function based on 2 drop down list to extract data from one sheet to a

    Hi Glenn,

    worked like a charm. I've reduced the cell range and it works a lot faster. Is there a way I can put a reference somewhere to adjust the cell range accordingly when the data is updated? I know the data will expand in terms of rows and I would like a method to to put in the exact cell range to update all the formula.

    Thanks
    F

  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,052

    Re: Index or Lookup function based on 2 drop down list to extract data from one sheet to a

    What you need are named ranges (3 of them, to be exact). CTRL-F3 to view /edit.

    This is the formula for the one called Channel:

    =Sample!$D$2:INDEX(Sample!$D$2:$D$10000,COUNTA(Sample!$D$2:$D$10000))

    It looks down column D, as far as row 10,000 and returns the range D2:last non-blank cell. It's the best way to do what you need. The fixed ranges in the formulae are then replaced with the dynamic named ranges...

    So, A7 becomes:

    =IFERROR(INDEX(Sample!$B:$B,AGGREGATE(15,6,ROW(Channel)/((Channel=IF($A$2="All",Channel,$A$2))*(Service=IF($A$3="All",Service,$A$3))*(Type=$A$5)),ROWS(A$7:A7))),"")

    There is no need for a named range for the $B:$B whole column reference, in this case, as it's very efficient.

    As before, I've only done the elft table. Have a go at doing the one on the right yourself.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    07-21-2016
    Location
    London
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2302 Build 16.0.16130.20806) 64-bit
    Posts
    94

    Thumbs up Re: Index or Lookup function based on 2 drop down list to extract data from one sheet to a

    Thanks Glenn,

    Amazing!!!!

+ 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. Fetch the data from another sheet based on drop down list
    By sreejeshc in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-25-2015, 02:26 AM
  2. Replies: 2
    Last Post: 02-18-2015, 06:01 AM
  3. [SOLVED] INDEX/MATCH Lookup based on Data from another sheet
    By mlbdc2012 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 02-08-2015, 10:38 PM
  4. [SOLVED] INDEX Lookup based on Rank and Data from another sheet
    By mlbdc2012 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-06-2015, 03:39 AM
  5. Extract Data from one Workbook to another based on a drop down list
    By J$wizzy1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-30-2014, 04:05 PM
  6. Returning a data list from one sheet to another based on a drop down menu
    By kk59204 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-16-2013, 01:21 PM
  7. Extract data from sheet selected from drop down list
    By kanight in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-22-2011, 07: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