Suppose I want to use the Evaluate function to calculate an array formula that returns a range of values. For example, I'm trying to get an index (using the Excel MATCH function) in an ordered list in Sheet2! A: A for each value in Sheet1! A: A. And I want to put indexes in column B.
Dim sh as Worksheet Set sh = Sheets("Sheet1") sh.Range("B1:B10").Value = sh.Evaluate("=MATCH(A1:A10,Sheet2!A:A)")
When I run the code, I get a column with duplicate values โโ- the values โโare equal to the index of the first element. This is not true.
When I try to do the same by placing the array formula on the worksheet {= MATCH (A1: A10, Sheet2! A: A)}, it works without problems and returns the correct index for each element.
So my question is: how to use the Evaluate function that returns the whole range of values?
source share