Forum Discussion
Marshall1954
Jun 16, 2022Copper Contributor
How do I keep a formula from changing when I advance the data?
I keep daily financial data in a horizontal table. Every day I insert a column on the left and add that day's prices. I want to have a spreadsheet that will calculate the average of the last 5 days....
Riny_van_Eekelen
Jun 16, 2022Platinum Contributor
Marshall1954 Let's say you want to returns the last 5-day average in D5, try this:
=AVERAGE(OFFSET(D5,0,1,1,5))
Marshall1954
Jun 16, 2022Copper Contributor
Good thinking and nice formula for finding the average but no, that changes too - the D5 just changes to E5 when I input the new data. Even if I add the $ sign in it.
- SergeiBaklanJun 16, 2022Diamond Contributor
It depends where do you insert new column, after the column D or not. You may anchor to column A slightly modifying the formula - if only new column is not before A.