VBA Vlookup Matching 2 Criteria

sthrncaliguy

Board Regular
Joined
Jul 28, 2009
Messages
213
Hello,

I am struggling with a method to do a Vlookup via VBA, but to match a row with 2 criteria, instead of the typical 1 criteria.

My VBA function is going to do something like this..

For r = 2 to 25
For c = 6 to 10
ws.cells(r,c).value = ... Here is where I need help. I need the value to = Row X, Col 8 from another worksheet. I need to determine Row X based on 2 criteria, whats in Col 1 and Col 4 for example. The criteria values I am trying to match will be identified as offset cells from the source. So the first criteria I need to match will be offset(0,-4) from (r,c), and criteria 2 I want to match will be offset(1,c) from (r,c) in my Loop.

I hope this makes sense. Essentially I am saying I need to identify which row on Sheet 2 has the text string "John" in Column A, and "Friday" in Column E, and I want to return the value in Column G from that row. There will only be 1 row that matches both criteria, but there will be several matches for either criteria in their respective columns.
 
Last edited:

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,224,534
Messages
6,179,391
Members
452,909
Latest member
VickiS

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top