Mathias Bech Jensen
New Member
Hey,
I have a problem at Work and I have spent 5 hours of searching the web now without any luck. So I will try my luck in here. BTW my VBA skills are relatively basic .
I want a vlookup code that can handle multiple criterias in VBA. I have tried the index/match function with inspiration from the link below, but I cannot figure out to transfer this to a VBA code:
http://www.exceltactics.com/vlookup...ch/4/#Using-INDEX-and-MATCH-with-Two-Criteria
My index array: Sheets("sheet1").Range("A:D")
1. criteria: 2015
2. criteria: 47
3. criteria: 39970002
When these 3 criterias are fulfilled, the returned value must be found in column D. I have tried this:
Regards,
Mathias
I have a problem at Work and I have spent 5 hours of searching the web now without any luck. So I will try my luck in here. BTW my VBA skills are relatively basic .
I want a vlookup code that can handle multiple criterias in VBA. I have tried the index/match function with inspiration from the link below, but I cannot figure out to transfer this to a VBA code:
http://www.exceltactics.com/vlookup...ch/4/#Using-INDEX-and-MATCH-with-Two-Criteria
My index array: Sheets("sheet1").Range("A:D")
1. criteria: 2015
2. criteria: 47
3. criteria: 39970002
When these 3 criterias are fulfilled, the returned value must be found in column D. I have tried this:
Code:
x = Application.WorksheetFunction.Index(Sheets("sheet1").Range("A:D"), _
Application.WorksheetFunction.Match(1, (Sheets("sheet1").Range("A:A") = 2015) _
* (Sheets("sheet1").Range("B:B") = 47) _
* (Sheets("sheet1").Range("C:C") = 39970002),0), 4)
Regards,
Mathias