Please refer to earlier posted question at Unable to use SUBSTITUTE(ADDRESS(MATCH))) combination as a range in a LOOKUP function in Excel
I was recommended this Excel formula to identify a value using reverse look-up by Scott Craner and it works:
=LOOKUP(2,1/((A:A=2018)*(B:B=31)),INDEX(A:AAA,0,MATCH("Employee2",1:1,0)))
In this case, the answer is numeric 15.
I wanted to convert the same to a VBA code statement using:
Dim i as Integer
i = Application.WorksheetFunction.Lookup(2, 1 / ((Range("A:A") = 2018) * (Range("B:B") = 31)),
Application.WorksheetFunction.Index(Range("A:AAA"), 0,
Application.WorksheetFunction.Match("Employee2", Range("1:1"), 0)))
It gives "Run-time error '13': Type mismatch".
Can someone please help me to figure out what I'm not doing right - in terms of converting the Excel formula to VBA?
Thanks for your help in advance.