I have written the following function to total up the values in a column where the values in columns 5 and 6 of a range I have created (called "lori") are equal to the values on another summary tab (details lower down)
Function StCashTotalGBP(Managed, Entity)
Counter = 1: StCashTotalGBP = 0
Do While Counter <= Range("lori").Rows.Count
If Range("lori").Item(Counter, 5) <> Managed Then GoTo NextRow
If Range("lori").Item(Counter, 6) <> Entity Then GoTo NextRow
StCashTotalGBP = StCashTotalGBP + Range("lori").Item(Counter, 80): GoTo NextRow
NextRow: Counter = Counter + 1
Loop
End Function
I use this formula on the summary tab
=StCashTotalGBP(E10, D10)
E10 provides the "managed" value (which is in column 5 of the "lori" range) and D10 provides the "entity value " (which is in column 6 of the "lori" range)
When I enter this formula I get the #NAME? error. I know that the combination of Managed and entity exists in the range - so why is this not working?!
Is it because I need to specify that this range is on another tab to the summary tab? (NB the function is held at the This workbook level
Any help greatly appreciated!