+ Reply to Thread
Results 1 to 8 of 8

Index / Match with Multiple Criteria

  1. #1
    Registered User
    Join Date
    12-14-2018
    Location
    Staffordshire, England
    MS-Off Ver
    365
    Posts
    60

    Index / Match with Multiple Criteria

    Hi All,

    I'm currently having some issues trying to build this formula despite all my limited best efforts. I've attached an example file but basically I need the formula in column D (sheet 1) to look up the origin in column B and Destination on column C (both on sheet 1) and also the week number in cell I2 (which would use a data validation list to change), and so therefore I can just change the week number and get the corresponding result from the table on sheet 2.

    Many thanks in advance
    Gaz
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Index / Match with Multiple Criteria

    You need an Index-Match-Match, where the first Match looks for a combination of Origin and Destination (concatenating them with the & symbol) to get the row and the second looks for the week number.

    The basic formula would be this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Important: this is an array formula so needs to be entered using Ctrl-Shift-Enter not just Enter. You will know the array is active when you see curly brackets { } appear around your formula - don't try to enter them yourself. If you do not Ctrl-Shift-Enter you will get an error or a clearly incorrect result. If that happens, just click into the formula bar and try again.


    However, there are two problems which cause this formula to not work:
    1. you have merged cells in column B on sheet1;
    2. you have blank cells in column B on sheet2.

    The best solution is this:
    1. un-merge the cells and just repeat the Origin as necessary, giving BJS, BJS, BKK, BKK, etc;
    2. fill in the blank cells to give the same effect.

    There is no way round (2) - you will have to fill those cells in. You can use Conditional Formatting to make them appear blank if you want.

    For (1), if you don't want to un-merge the cells and you will never have more than two rows for each origin on Sheet1, you can amend the formula to this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Again, enter with Ctrl-Shift-Enter.

    Where there is no answer (for example, there is no BJS-IE), you will get an error. You can hide this with IfError, like this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Again, C-S-E to enter.


    Attached is your file with that last formula and Conditional Formatting to half-hide the repeated Origins on Sheet2.

    Hope that helps.

    Edit: added colour to highlight parts of formulae
    Last edited by Aardigspook; 02-07-2019 at 08:23 AM. Reason: Add colours
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

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

    Re: Index / Match with Multiple Criteria

    Please try at D3 and drag down

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



    or if you fill blank Departure Port in sheet 2
    D3
    =IFERROR(1/(1/LOOKUP(1,1/(LOOKUP("z",B$3:B3)=Sheet2!$B$4:$B$23)/(C3=Sheet2!$C$4:$C$23),INDEX(Sheet2!$D$4:$O$23,,MATCH($I$2,Sheet2!$D$3:$O$3,)))),"")
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    12-14-2018
    Location
    Staffordshire, England
    MS-Off Ver
    365
    Posts
    60

    Smile Re: Index / Match with Multiple Criteria

    Many thanks Aardigspook, that is a massive help!

  5. #5
    Registered User
    Join Date
    12-14-2018
    Location
    Staffordshire, England
    MS-Off Ver
    365
    Posts
    60

    Re: Index / Match with Multiple Criteria

    Thanks also for the alternate solution Bo Ry! Much appreciated!

  6. #6
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Index / Match with Multiple Criteria

    You're welcome, glad we could help and thanks for the rep.

    If that takes care of your original question, then please take a moment to mark the thread as Solved so others know there's an answer here (instructions are in my sig). Thanks.

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,745

    Re: Index / Match with Multiple Criteria

    Agree with all said about merged cells, blank cells Origins.

    This also works around that ... but it's a real mess.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Dave

  8. #8
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,745

    Re: Index / Match with Multiple Criteria

    Drawing upon Bo's LOOKUP("z" approach ...

    This is shorter and simpler than my last.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ 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] Index Match with multiple criteria and date criteria
    By snolem75 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-28-2018, 03:51 PM
  2. Replies: 16
    Last Post: 01-05-2018, 11:04 PM
  3. Index and match - multiple possible match criteria
    By JDobbsy1987 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-01-2017, 01:52 PM
  4. Need help in Index, Match usage to match multiple criteria in sum function
    By Summer0830 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-26-2017, 02:47 AM
  5. Index/Match to Match entries on multiple criteria
    By manning457 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-06-2015, 02:32 PM
  6. [SOLVED] Index Match with Multiple Criteria Using Same Criteria Column
    By rominjn in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-05-2015, 11:34 AM
  7. Replies: 2
    Last Post: 09-27-2014, 04:34 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