To do lookup with two criteria, in Excel-Formula, it would be written as:
{MATCH(1, 1*(A1:A5=100)*(B1:B5=150), 0)}
How do i write the above formula in VBA syntax for the WorksheetFunction.Match
function?
I don't have enough rep to post a comment.. This is to aid anyone searching for how to use the answer from "Gary's Student" with variables. I wrestled with this for over an hour. The brackets [] used are a shortcut for evaluate(string) You have to replace those and wrap them in the evaluate method. Since the parameter is a string, you can construct the string yourself with the variables you need.
Sub dural()
Dim m As Long
With Application.WorksheetFunction
m = .Match(1, evaluate("1*(A1:A5=100)*(B1:B5=150)"), 0)
End With
MsgBox m
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.