I need to create a range between B5:M5 that is defined by the location of P1 (phase 1) and P2 (phase 2) in Row 4. The range should begin one column to the right and one row down from P1 and end at the cell one column to the left and one row down from P2.
P1 and P2 are both movable and so moving them left/right should make longer/shorter ranges depending on which cells in row 4 they are moved to. P1 is always to the left of P2.
In example 1 the locations of P1 and P2 give a range a range of 8 cells in row 5. All cells in this range bar the final cell should be 80% of A5 (highlighted in blue) divided by the number of cells in the range bar the final cell. I.e. =SUM($A$5*80%/7) because there are 7 cells in the 8-cell range not including the final cell. The final cell in the range (K5) should be 20% of A5. All values in the range D5:K5 sum to 100% of A5.
In example 2, P1 and P2 are moved closer together, giving a range in row 9 of 4 cells. The first 3 cells should be 80% of A9 divided equally across the 3 cells E9:G9, and the final cell H9 should be 20% of A9.
I'm struggling to write a formula to apply to B5:M5 in example 1 and B9:M9 in example 2 which achieves the above, advice would be really appreciated, thank you.
P1 and P2 are both movable and so moving them left/right should make longer/shorter ranges depending on which cells in row 4 they are moved to. P1 is always to the left of P2.
In example 1 the locations of P1 and P2 give a range a range of 8 cells in row 5. All cells in this range bar the final cell should be 80% of A5 (highlighted in blue) divided by the number of cells in the range bar the final cell. I.e. =SUM($A$5*80%/7) because there are 7 cells in the 8-cell range not including the final cell. The final cell in the range (K5) should be 20% of A5. All values in the range D5:K5 sum to 100% of A5.
In example 2, P1 and P2 are moved closer together, giving a range in row 9 of 4 cells. The first 3 cells should be 80% of A9 divided equally across the 3 cells E9:G9, and the final cell H9 should be 20% of A9.
I'm struggling to write a formula to apply to B5:M5 in example 1 and B9:M9 in example 2 which achieves the above, advice would be really appreciated, thank you.