First of all, I'm quite of a begginer in VBA.
I'm trying to create a function that returns a cell inside a table if I specify the value of the row and column using a combination of INDEX and MATCH.
This is my code:
Then when writing the function inside a cell I place named ranges in table, LookUpArray1 and LookUpArray2 and cells in LookUpValue1 and LookUpValue2
Something like this: =ReturnValueFromTable(Table1;M2;ExampleColumn;N2;ExampleRow)
It returns #VALUE!
I'm trying to create a function that returns a cell inside a table if I specify the value of the row and column using a combination of INDEX and MATCH.
This is my code:
VBA Code:
Function ReturnValueFromTable(Table As String, LookUpValue1 As String, LookUpArray1 As String, LookUpValue2 As String, LookUpArray2 As String) As Double
ReturnValueFromTable = Application.WorksheetFunction.Index(Range(Table), Application.WorksheetFunction.Match(LookUpValue1, Range(LookUpArray1), 0), Application.WorksheetFunction.Match(LookUpValue2, Range(LookUpArray2), 0))
End Function
Then when writing the function inside a cell I place named ranges in table, LookUpArray1 and LookUpArray2 and cells in LookUpValue1 and LookUpValue2
Something like this: =ReturnValueFromTable(Table1;M2;ExampleColumn;N2;ExampleRow)
It returns #VALUE!