My problem:
I have the below tables:
In my second table (tbl_analysis), I need to create a formula in the Sum column that will sum the salary of a certain person over a certain period. When the period changes, the formula needs to be recalculated.
My try:
I started off by using the formula:
=SUM(my_range)
By the range can't be hard-coded, so I decided to find the cell address of the corresponding month as you can see in the range D12:E15
Formula in the cell D12: =CELL("address",INDEX($A$2:$M$8,MATCH(A12,$A$2:$A$8,0),MATCH(B12,$A$2:$M$2,0)))
So when I tried to insert the above formula inside of the SUM formula like this:
=SUM(CELL("address",INDEX($A$2:$M$8,MATCH(A12,$A$2:$A$8,0),MATCH(B12,$A$2:$M$2,0))) : CELL("address",INDEX($A$2:$M$8,MATCH(A12,$A$2:$A$8,0),MATCH(C12,$A$2:$M$2,0))))
And then Excel is referecing the cell address itself and not the address inside of the formula.