Hi,
I posted an array formula question on the 2nd of Nov at 09:17, which was answered, but frustrating only raised more questions. Having done a bit more reading-up on array formulae, I thought I would try and answer them myself. The problem I have is with the following formula:
SUM(OFFSET($A$1,MATCH($A$5:$A$9,$A$1:$A$3,0)-1,1,1,1))
In cells A1:B3 I have a look-up table and A5:A9 a column of values. The intent of the formula is to step thru the values in A5:A9, look-up the value in A1:A3, note the value in the adjacent column B1:B3, then add these valves (the total is 48). The values quoted in the noted ranges are as follows:
A1:A3 = {1;2;3}, B1:B3 = {7;10;12} and A5:A9 ={1;1;3;3;2}
When I input: SUM(OFFSET($A$1,MATCH($A$5:$A$9,$A$1:$A$3,0)-1,1,1,1)) and press Ctrl + Shift + Enter the cell returns 7 (and not 48).
However, when I highlight MATCH($A$5:$A$9,$A$1:$A$3,0)-1 and press F9, it is replaced with {0;0;2;2;1} i.e. SUM(OFFSET($A$1,{0;0;2;2;1},1,1,1)). Then if I highlight the OFFSET function and press F9 the formula simplifies to SUM({7;7;12;12;10}), which after pressing Ctrl + Shift + Enter returns 48 i.e. the answer.
My question is, why when I step through the formula using F9 do I get the desired result, yet when I input SUM(OFFSET($A$1,MATCH($A$5:$A$9,$A$1:$A$3,0)-1,1,1,1)) the output is 7 (i.e. not the answer, least not the answer I want).
Any help / assistance would be massively appreciated.
Kind regards,
2016LM
I posted an array formula question on the 2nd of Nov at 09:17, which was answered, but frustrating only raised more questions. Having done a bit more reading-up on array formulae, I thought I would try and answer them myself. The problem I have is with the following formula:
SUM(OFFSET($A$1,MATCH($A$5:$A$9,$A$1:$A$3,0)-1,1,1,1))
In cells A1:B3 I have a look-up table and A5:A9 a column of values. The intent of the formula is to step thru the values in A5:A9, look-up the value in A1:A3, note the value in the adjacent column B1:B3, then add these valves (the total is 48). The values quoted in the noted ranges are as follows:
A1:A3 = {1;2;3}, B1:B3 = {7;10;12} and A5:A9 ={1;1;3;3;2}
When I input: SUM(OFFSET($A$1,MATCH($A$5:$A$9,$A$1:$A$3,0)-1,1,1,1)) and press Ctrl + Shift + Enter the cell returns 7 (and not 48).
However, when I highlight MATCH($A$5:$A$9,$A$1:$A$3,0)-1 and press F9, it is replaced with {0;0;2;2;1} i.e. SUM(OFFSET($A$1,{0;0;2;2;1},1,1,1)). Then if I highlight the OFFSET function and press F9 the formula simplifies to SUM({7;7;12;12;10}), which after pressing Ctrl + Shift + Enter returns 48 i.e. the answer.
My question is, why when I step through the formula using F9 do I get the desired result, yet when I input SUM(OFFSET($A$1,MATCH($A$5:$A$9,$A$1:$A$3,0)-1,1,1,1)) the output is 7 (i.e. not the answer, least not the answer I want).
Any help / assistance would be massively appreciated.
Kind regards,
2016LM
Last edited: