+ Reply to Thread
Results 1 to 8 of 8

Using index match function instead of VLOOKUP to match two criteria in another worksheet

  1. #1
    Registered User
    Join Date
    10-03-2019
    Location
    London
    MS-Off Ver
    2013
    Posts
    7

    Using index match function instead of VLOOKUP to match two criteria in another worksheet

    Hello
    I am a basic Excel 2013 user.
    I am trying to use the INDEX and MATCH function to match 2 criteria: a number and a date field together in my current worksheet to a reference set of values in a different work sheet and return a value from an adjacent cell once the combination of criteria are matched.

    STS is a lookup sheet with 3 columns A$2:$C$5260

    STS!A2 contains a number "ID" I wish to match with the ID number in B3 in my output worksheet.
    STS!B2 contains a date field "Contact date" that I wish to match with the Contact date I3 in my output worksheet. The combination of ID and Contact date in STS is (should be) unique.
    Finally STS!C2 contains a string of text that I want to display in my cell having matched the two criteria (see attached pic)
    Excel problem.PNG

    Here is the formula I have used in my output worksheet in the cell where I wish to return the value from the 3rd column in the STS Workbook

    {=INDEX(STS!$A$2:$C$5260,MATCH(1,(STS!$A$2:$C$5260=B3)*(STS!$A$2:$C$5260=I3),0),3)}

    I get the value "#NA" instead of the text from the 3rd column of STS.

    When I click into the formula - the cells in my worksheet that are used as criteria are highlighted but the array STS!$A$2:$C$5260 is not highlighted with a colour as though it can't be seen.

    Any ideas

    Thanks in advance

  2. #2
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Using index match function instead of VLOOKUP to match two criteria in another workshe

    No Need for array:
    =LOOKUP(2,1/(STS!$A$2:$C$5260=B3)/(STS!$A$2:$C$5260=I3),STS!$A$2:$C$5260)
    When I click into the formula - the cells in my worksheet that are used as criteria are highlighted but the array STS!$A$2:$C$5260 is not highlighted with a colour as though it can't be seen.
    That's due to the fact that you reference is on another sheet
    Click the * to say thanks.

  3. #3
    Registered User
    Join Date
    10-03-2019
    Location
    London
    MS-Off Ver
    2013
    Posts
    7

    Re: Using index match function instead of VLOOKUP to match two criteria in another workshe

    Thank you PaulM100 for your reply.
    I entered your formula in my master worksheet but I get the same #NA error.

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

    Re: Using index match function instead of VLOOKUP to match two criteria in another workshe

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? However, please give us an indication of the approximate number of rows of data you want the solution to work with (100, 1000, 100,000 or whatever). Please DO NOT attach a picture of an Excel sheet (I do not have the patience to re-type any/all your stuff before starting).

    1. It does NOT have to be your real sheet - mock up a SAMPLE if you need to. But not 1000's of rows!!! It makes manual checking so tedious. Whatever you do... make sure that all confidential information is removed first!!

    2. Make sure that your sample data are truly REPRESENTATIVE of your real data. For example, don't show text in a column if it's really a number. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    3. Make sure that your desired solution is also shown (mock up the results manually). To be honest, I am not interested in seeing a non-working formula... or a pile of blank cells. However, I am very interested in seeing your EXPECTED results in their EXPECTED location.

    4. Try not to use merged cells. They cause lots of problems and are DEFINITELY best avoided!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    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

  5. #5
    Registered User
    Join Date
    10-03-2019
    Location
    London
    MS-Off Ver
    2013
    Posts
    7

    Re: Using index match function instead of VLOOKUP to match two criteria in another workshe

    OK sure. I am attaching as per instructions - I hope it works.
    My actual dataset is about 6k rows
    Attached Files Attached Files

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

    Re: Using index match function instead of VLOOKUP to match two criteria in another workshe

    Is this what you wanted??

    =INDEX(STS!$C$2:$C$6000,MATCH(1,INDEX((STS!$A$2:$A$6000=B2)*(ROUND(STS!$B$2:$B$6000*1440,0)/1440=ROUND(1440*C2,0)/1440),0),0))

    and

    =LOOKUP(2,1/(STS!$A$2:$A$6000=B2),STS!$C$2:C$6000)

    see sheet.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    10-03-2019
    Location
    London
    MS-Off Ver
    2013
    Posts
    7

    Re: Using index match function instead of VLOOKUP to match two criteria in another workshe

    That's great Glen, thank you they both work.
    The LOOKUP version is a much neater solution. I will use that in the future

    Best wishes

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

    Re: Using index match function instead of VLOOKUP to match two criteria in another workshe

    You're welcome.

+ 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. 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
  2. [SOLVED] Index/vlookup with 2 match criteria
    By adamheon in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-25-2016, 01:17 AM
  3. Multiple criteria vlookup with INDEX and MATCH
    By Ljung in forum Excel General
    Replies: 5
    Last Post: 05-26-2016, 04:45 AM
  4. [SOLVED] vlookup or match index with two criteria help
    By gondal in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-24-2016, 11:39 AM
  5. How to index and match two criteria from different worksheet
    By Lynn D in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-24-2014, 03:04 PM
  6. Replies: 6
    Last Post: 04-30-2014, 02:42 AM
  7. vlookup? match? index? MULTIPLE criteria for vlookup search problem....
    By aborg88 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 02-11-2013, 09:56 AM

Tags for this Thread

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