SOLVED

How to forecast based on 3/5/7/10 etc. last observations?

%3CLINGO-SUB%20id%3D%22lingo-sub-2704300%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20forecast%20based%20on%203%2F5%2F7%2F10%20etc.%20last%20observations%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2704300%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1142659%22%20target%3D%22_blank%22%3E%40AlinaP92%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESelect%20B23%3AB32.%3C%2FP%3E%0A%3CP%3EEnter%20the%20formula%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3DFORECAST.LINEAR(%24A%2423%3A%24A%2432%2C%24B%2422%3AOFFSET(%24B%2422%2C-%24E%242%2B1%2C0)%2C%24A%2422%3AOFFSET(%24A%2422%2C-%24E%242%2B1%2C0))%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20have%20Microsoft%20365%2C%20simply%20press%20Enter.%20Otherwise%2C%20press%20Ctrl%2BShift%2BEnter.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2703944%22%20slang%3D%22en-US%22%3EHow%20to%20forecast%20based%20on%203%2F5%2F7%2F10%20etc.%20last%20observations%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2703944%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20everyone.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20two%20columns%20of%20observations%3A%20Date%20and%20Number%20of%20Registrations.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20task%20is%20to%20forecast%20the%20number%20of%20registrations%20for%20the%20remaining%20days%20based%20on%203%2F5%2F7%2F10%20last%20values.%20So%20the%20first%20time%20I%20have%20to%20pick%20values%20from%20May%2019th%20till%20May%2021th%2C%20the%20second%20time%20-%20from%20May%2017th%20till%20May%2021th%20and%20so%20on.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20problem%20is%2C%20that%20there%20is%20a%20cell%20with%20a%20fixed%20number%20of%20days%20I%20have%20to%20use.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20struggling%20to%20adjust%20my%20forecast.linear()%20function%20so%20it%20takes%20into%20account%20these%20changes.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20file%20with%20the%20data%20is%20attached.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2703944%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
New Contributor

Hello everyone. 

 

I have two columns of observations: Date and Number of Registrations. 

 

My task is to forecast the number of registrations for the remaining days based on 3/5/7/10 last values. So the first time I have to pick values from May 19th till May 21st, the second time - from May 17th till May 21st, and so on. 

 

The problem is, that there is a cell with a fixed number of days I have to use. There is a dropdown list that should affect the forecast every time I change the value in it.

 

I've been struggling the whole day to adjust my forecast.linear() function so it takes into account these changes.

 

The file with the data is attached.

 

Would appreciate any help.

 
4 Replies
best response confirmed by AlinaP92 (New Contributor)
Solution

@AlinaP92 

Select B23:B32.

Enter the formula

 

=FORECAST.LINEAR($A$23:$A$32,$B$22:OFFSET($B$22,-$E$2+1,0),$A$22:OFFSET($A$22,-$E$2+1,0))

 

If you have Microsoft 365, simply press Enter. Otherwise, press Ctrl+Shift+Enter.

Thank you @Hans Vogelaar! That's what I wanted.

 

A quick question: OFFSET() function returns a value, not a cell address. How does Excel understand that I want B20 and not 7208950, also I got 7208950 applying OFFSET? It would be $B$22:7208950. 

@AlinaP92 

OFFSET in fact returns a cell reference. For example, OFFSET(A1,2,0) returns a reference to cell A3.

In most uses, you will get the value of the cell it references to: if you enter the formula =OFFSET(A1,2,0) you will see the value of cell A3, just like when you enter the formula =A3.

But when constructing a range, you are using the cell reference returned by OFFSET.

A1:OFFSET(A1,2,0) is equivalent to A1:A3, not to A1:value_of_A3.

Understood, thank you for the explanation.