Demand Forecasting in Excel Step by Step
In this article
Demand forecasting in Excel helps you predict future sales by analyzing past data and trends, essential for inventory planning and budgeting.
What You'll Need
- Excel installed on your computer, version 2016 or later, which includes the FORECAST.LINEAR and FORECAST.ETS functions.
- Historical sales data stored in a worksheet, with each row representing a time period and columns for date, product identifier and quantity sold.
- Basic familiarity with Excel functions and chart tools.
Step-by-Step
- Organize your sales data: Place dates in column A starting at A2, product codes in column B, and sales figures in column C. Ensure there are no blank rows between entries and that the data is sorted chronologically. For example, A2 might contain 01/01/2023, B2 could be Product001, and C2 could hold 1250.
- Add a moving average column: In cell D2 enter
=AVERAGE(C2:INDEX(C:C, ROW()))and drag the formula down. This smooths short‑term fluctuations. If you want a 4‑period moving average, use=AVERAGE(OFFSET(C2,0,0,4,1)). The moving average helps reveal underlying trend without the noise of daily spikes. - Insert a trendline: Highlight the sales data in column C, go to the Insert tab, choose Line Chart, then right‑click the line and select Add Trendline. Choose Linear for a steady growth pattern or Exponential if growth accelerates. Tick the Display Equation on Chart box to see the slope and intercept, which you can later use in custom forecasts.
- Calculate seasonal indices: Create a pivot table by inserting a new worksheet, selecting your data range, and choosing Insert > PivotTable. Drag the Date field to Rows, then group by Months and Years. Add Sales to Values and set it to Average. After the pivot is built, add a new column for Index. In the first row of that column, enter
=B2/AVERAGE($B$2:$B$13)(adjust the range to your pivot data) and copy down. This index shows how a particular month’s sales compare to the overall average; a value above 1 indicates higher‑than‑average demand. - Forecast future periods with FORECAST.LINEAR: In a new column, say column E, list the future dates you want to predict (e.g., starting at E2 with the next month’s date). In F2 enter
=FORECAST.LINEAR(E2, $C$2:$C$13, $A$2:$A$13). Drag the formula down for each future date. This uses the linear regression of known X (dates) and Y (sales) to estimate the next value. - Use exponential smoothing for more nuanced forecasts: If your data shows seasonality, the built‑in ETS (Exponential Smoothing) functions are more appropriate. In G2 enter
=FORECAST.ETS(E2, $C$2:$C$13, $A$2:$A$13, 1, 1, 1). The second argument is the known sales range, the third is the known dates, the fourth is a step for seasonality (1 for automatic), the fifth is a confidence level, and the sixth is a data‑completion flag. This function returns a forecast that accounts for trend and seasonal patterns. - Validate the forecast with a confidence interval: To see the upper and lower bounds, use
=FORECAST.ETS.CONFINT(E2, $C$2:$C$13, $A$2:$A$13, 0.95). This tells you the range within which the true future sales likely fall, helping you plan safety stock. - Visualize the results: Select the combined historical sales, moving average, and forecast columns, then Insert > Line Chart. Add a secondary axis for the seasonal index if desired. A clear visual lets you spot anomalies such as unexpected drops or spikes that may require data cleaning.
Common Mistakes
One frequent error is using non‑numeric entries in the sales column; hidden text or spaces cause the forecast functions to return #VALUE! errors. Another mistake is forgetting to lock cell references when copying formulas across rows, which leads to incorrect ranges and skewed predictions. Misaligning the date ranges between known and future periods also produces unrealistic numbers. Additionally, using a moving average window that does not match your business cycle (for example, a 7‑day average for monthly data) can smooth out meaningful seasonal patterns.
Tips
Name your ranges for clarity: select the sales data and choose Formulas > Define Name, calling it SalesData. Then you can write =FORECAST.LINEAR(E2, SalesData, Dates) which is easier to read. Keep the data sorted; Excel’s forecasting functions assume chronological order. When you add new months, extend the ranges in the formulas or convert the data to an Excel Table (Insert > Table) so that formulas automatically expand. Regularly compare the forecast against actual sales to assess accuracy; if the error exceeds 10 %, consider revisiting the moving average period or the seasonality setting.
Additional Section: Interpreting Seasonal Indices
After you have calculated seasonal indices, you can apply them to raw forecasts to adjust for expected peaks and troughs. Suppose the raw forecast for July is 2000 units and the July index is 1.25. Multiply 2000 by 1.25 to obtain an adjusted forecast of 2500 units. This adjustment reflects the typical increase in demand during that month. Conversely, if the index is 0.80 for a slow month, the adjusted forecast will be lower, helping you avoid over‑stocking.
Additional Section: Handling New Products
When forecasting for a product that has no historical sales, you can borrow the average seasonal index from a similar product or from the overall product line. Create a separate sheet for new items, copy the index column from the existing pivot, and apply it to the raw linear forecast. This approach provides a reasonable estimate without inflating the model with insufficient data.
Troubleshooting
If the forecast line shows sudden spikes that do not align with business intuition, first check for outliers in the raw sales data. Use Excel’s conditional formatting to highlight values that deviate more than three standard deviations from the mean. Remove or adjust those entries, then recompute the moving average and forecast. Next, verify that the seasonality argument in FORECAST.ETS reflects the correct period; for monthly data with annual seasonality, set the seasonality argument to 12. Finally, ensure that the date axis in the chart is formatted as a true date scale, not as text, so that Excel interprets the time intervals correctly.
Frequently Asked Questions
What if my data contains missing months?
Leave the missing month’s sales cell empty or enter zero, but be aware that zero can artificially lower the average. A better practice is to fill the gap with the average of the surrounding months before running the forecast, then note that the adjustment may affect seasonal indices.
Can I automate the whole process with a macro?
Yes, you can record a macro that applies the moving average formula, inserts the forecast formulas, and creates the chart. However, ensure the macro uses relative references that adapt to the size of the data range, and test it on a copy of the workbook first.
Do I need to adjust the forecast when I change the data source?
Absolutely. Whenever you add new rows of data, update the ranges in the formulas or convert the data to a Table so that all dependent formulas expand automatically. Failing to do so will cause the forecast to use stale data and produce inaccurate results.