+ Reply to Thread
Results 1 to 3 of 3

Look up with 2 criteria

  1. #1
    Registered User
    Join Date
    10-22-2011
    Location
    Europe
    MS-Off Ver
    Excel 2007
    Posts
    11

    Question Look up with 2 criteria

    Hi guys,

    I've the impression this is a recurrent topic, but I haven't been able to find a working solution on the internet after several hours of investigation .

    I am trying to retrieve the data from one column, based on the values of two other columns (criteria). We can assume there are no repetitions. I am trying to achieve this with a combination of INDEX + MATCH and Worksheetfunction or Evaluate, because:

    - other potential solutions include loops, and this may take lot of time in my Excel, which contains several thousands of rows
    - I am looking for the simplest solution, and using Excel formulas looks simpler that several nested loops

    I have managed to make the code work, but when I try to replace the specific addresses e.g. Source!B3:B9 with variables e.g. Rng_Country is when the code does not work, and (I think) I need to use variables because I want to apply this logic to several columns and thousands of lines.

    Could any of you shed some light about the correct way here?

    Many thanks
    Attached Files Attached Files
    Last edited by Eldexoly; 12-15-2021 at 04:08 PM. Reason: [SOLVED]

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,423

    Re: Look up with 2 criteria

    You can use this array* formula in D3:

    =INDEX(Source!$D$3:$D$9,MATCH(1,(B3=Source!$B$3:$B$9)*(C3=Source!$C$3:$C$9),0))

    *Note that an array formula needs to be confirmed using the key combination of Ctrl-Shift-Enter (CSE) instead of the usual Enter.

    Copy the formula down using your usual method(s).

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    10-22-2011
    Location
    Europe
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Look up with 2 criteria

    Hi Pete_UK,

    Thank you for the suggestion. I was looking for a VBA solution. Finally I felt in the arms of the loop, but I apply it to an array loaded in memory, so I expect it to be faster. Attached the Excel with the solution for future reference.

    Have a great eve.
    Attached Files Attached Files

+ 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: 1
    Last Post: 04-09-2021, 11:09 AM
  2. Replies: 2
    Last Post: 12-27-2020, 04:10 AM
  3. [SOLVED] Usine sumifs to change criteria range column based on dynamic criteria
    By Luiscarlos in forum Excel General
    Replies: 5
    Last Post: 11-19-2020, 09:33 AM
  4. Replies: 1
    Last Post: 03-25-2020, 08:06 AM
  5. Replies: 2
    Last Post: 01-03-2017, 08:40 AM
  6. Replies: 4
    Last Post: 11-01-2016, 03:28 PM
  7. Replies: 4
    Last Post: 01-08-2013, 12:37 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