OFFSET combined with SUM or AVERAGE
The OFFSET function on its own is not particularly advanced, but when we combine it with other functions like SUM or AVERAGE we can create a pretty sophisticated formula. Suppose you want to create a dynamic function that can sum a variable number of cells. With the regular SUM formula, you are limited to a static calculation, but by adding OFFSET you can have the cell reference move around.
How it works: To make this formula work, we substitute ending reference cell of the SUM function with the OFFSET function. This makes the formula dynamic and the cell referenced as E2 is where you can tell Excel how many consecutive cells you want to add up. Now we’ve got some advanced Excel formulas!
Below is a screenshot of this slightly more sophisticated formula in action.
Add caption |
As you see, the SUM formula starts in cell B4, but it ends with a variable, which is the OFFSET formula starting at B4 and continuing by the value in E2 (“3”), minus one. This moves the end of the sum formula over 2 cells, summing 3 years of data (including the starting point). As you can see in cell F7, the sum of cells B4:D4 is 15, which is what the offset and sum formula gives us.
That's great
ReplyDelete