To use the forecast function in Excel, type =FORECAST(x, known_ys, known_xs) into a cell, where x is the future data point you want to predict, known_ys is the range of historical values you already have, and known_xs is the range of time periods or other independent values that match those historical values. For example, =FORECAST(13, B2:B12, A2:A12) returns the predicted value for period 13 based on the linear trend in your data. This function performs a simple linear regression and is ideal for straightforward trends, but Excel also offers newer, more flexible forecasting tools for seasonal data.
What Is the FORECAST Function?
FORECAST is a statistical function in Excel that predicts a future value by fitting a straight line through your existing data points. It uses the least-squares method, which finds the line that minimizes the total squared distance between the line and your historical points. The function then extends that line to the x-value you specify and returns the corresponding y-value on the line.
The syntax is =FORECAST(x, known_ys, known_xs). All three arguments are required:
x– the independent value (e.g., a future time period) for which you want a prediction.known_ys– the dependent values (e.g., sales, temperatures) that you have observed.known_xs– the independent values (e.g., time periods, advertising spend) that correspond toknown_ys.
For example, if you have monthly sales for January through December in cells B2:B13 and the month numbers 1 through 12 in A2:A13, then =FORECAST(13, B2:B13, A2:A13) returns the predicted sales for the next month (period 13). The function assumes a linear relationship, so if your data curves or has seasonal spikes, the prediction may be off.
FORECAST vs. FORECAST.LINEAR vs. FORECAST.ETS
Excel has three related functions, and choosing the right one matters:
- FORECAST – the original function, kept for compatibility. It works exactly like FORECAST.LINEAR.
- FORECAST.LINEAR – the modern replacement, introduced in Excel 2016. Use this for linear trends; it’s more accurate and better documented.
- FORECAST.ETS – stands for Exponential Triple Smoothing. This is for data with seasonality (e.g., retail sales that peak every December) and can also forecast multiple periods ahead. It uses more complex algorithms and requires a regular time interval.
For a simple straight-line prediction, use =FORECAST.LINEAR(13, B2:B13, A2:A13). If your data shows a clear repeating pattern, use =FORECAST.ETS(13, B2:B13, A1:A12, 1, 1) where the fourth argument (seasonality) is set to 1 for automatic detection. The ETS function also returns confidence intervals when used with FORECAST.ETS.CONFINT.
How to Use FORECAST: Step-by-Step Example
Let’s walk through a realistic example. Suppose you run a small business and have recorded sales for the first six months of the year in cells B2:B7, with month numbers 1–6 in A2:A7.
- Click on an empty cell, say B9.
- Type
=FORECAST.LINEAR(7, B2:B7, A2:A7)and press Enter. - Excel returns the predicted sales for month 7. If your actual sales were 100, 120, 140, 160, 180, 200, the function returns 220 (since the trend is +20 per month).
You can also use the Forecast Sheet feature (Excel 2016 and later) to create a chart and full table of future values. Select your data, go to Data > Forecast Sheet, choose a chart type, and adjust the forecast end date. This creates a new worksheet with a table of predicted values and confidence intervals.
Choosing the Right Data for FORECAST
FORECAST works best when your data meets certain conditions:
- Linear trend: The relationship between x and y should be roughly a straight line. If the data curves, consider polynomial or exponential fitting.
- No missing points: The known_xs should be evenly spaced (e.g., 1,2,3… or Jan, Feb, Mar). Gaps can distort the regression.
- Independent x values: The x values should be numeric and distinct. If you use dates, Excel converts them to serial numbers automatically, which is fine.
- At least two data points: You need at least two pairs to draw a line, but more points give a more reliable trend.
If your data has seasonality, FORECAST.LINEAR will ignore it. For example, ice cream sales rise every summer; a linear forecast might predict a flat upward trend, missing the seasonal peaks. In that case, use FORECAST.ETS or add seasonal dummy variables.
Common Errors and How to Fix Them
You may encounter these errors when using FORECAST:
- #N/A – The lengths of known_ys and known_xs are different, or one of the ranges is empty. Check that both ranges have the same number of cells.
- #VALUE! – The x value or any known_xs is non-numeric (e.g., text). Convert text numbers to actual numbers.
- #DIV/0! – The variance of known_xs is zero (all x values are identical). You need at least two distinct x values.
- #NUM! – The x value is outside the range of known_xs? Actually, FORECAST allows extrapolation, so this error usually appears with FORECAST.ETS when the seasonality or confidence settings are invalid.
To debug, select the cell with the error and click the error icon to see details. Also, verify that your ranges are correct by highlighting them in the formula bar.
FORECAST in Excel for Mac and Web
The FORECAST function works the same in Excel for Microsoft 365 on Windows, Mac, and Excel for the web. The syntax is identical. On Mac, you can enter the formula manually or use the Function Builder (fx button). In Excel for the web, the function is available, but the Forecast Sheet feature is not. If you need the full forecasting tools, use the desktop version.
Keyboard shortcuts: To insert a function, press Shift+F3 on Windows or Fn+Shift+F3 on Mac to open the Insert Function dialog. There, search for FORECAST.
Alternatives to FORECAST
If FORECAST doesn’t fit your data, consider these alternatives:
- TREND – Returns multiple predicted y-values for multiple new x-values as an array. Useful for generating a whole forecast line.
- LINEST – Returns the slope and intercept of the regression line, which you can use in a formula like
=slope*x+intercept. - GROWTH – Fits an exponential curve, useful for data that grows at a constant percentage rate.
- Moving average – Use the AVERAGE function over a rolling window to smooth out noise, though it doesn’t predict beyond the data.
- Excel’s Forecast Sheet – As mentioned, this creates a full forecast with charts and confidence intervals automatically.
For example, if your sales double every year, GROWTH would be more appropriate than FORECAST. Use =GROWTH(B2:B7, A2:A7, 7) to predict the 7th period.
Frequently Asked Questions
Can FORECAST predict more than one period ahead?
Yes, but you need to call the function for each future period. For example, to predict periods 7, 8, and 9, you would enter =FORECAST.LINEAR(7, B2:B7, A2:A7) in one cell, =FORECAST.LINEAR(8, B2:B7, A2:A7) in the next, and so on. Alternatively, use the TREND function with an array of new x-values.
Does FORECAST work with dates?
Yes. Excel stores dates as serial numbers, so you can use a date range as known_xs. For instance, if your dates are in A2:A13 and sales in B2:B13, you can forecast for a future date by entering that date as the x argument, e.g., =FORECAST.LINEAR(DATE(2025,1,1), B2:B13, A2:A13). The function will treat the date as a number.
Why is my FORECAST result different from the trendline in a chart?
The chart trendline may use a different method (e.g., polynomial or moving average) or may be based on a subset of data. Also, if you have hidden rows or filtered data, the chart might exclude them while the function includes all cells in the range. Ensure both use the same data set and linear type.
Is FORECAST the same as linear regression?
Yes, FORECAST performs simple linear regression with one independent variable. It calculates the slope and intercept using the least-squares method, then predicts y = slope * x + intercept. For multiple independent variables, use the LINEST function or the Data Analysis Toolpak’s Regression tool.
Can I use FORECAST with non-numeric x values like months?
If you have text months (e.g.,
Related
- Generate Random Number in Golang: A Complete Guide
- How to Unmerge Excel Cells (2 Quick Ways)
- How to Ungroup Cells in Excel (Rows & Columns)
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Excel Not Responding and Won’t Close? Try These FixesIf Excel says Not Responding and will not close, first give it a minute if it may be…
- Excel Group of Schools Zimbabwe: Full GuideExcel Group of Schools Zimbabwe is a private Christian school network with campuses in Harare and Bulawayo, offering…
- How to Enter Data in RStudio: A Step-by-Step GuideEntering data in RStudio is the first step to any analysis. You can type data directly, use R’s…
- Group Rows in Excel by Cell ValueTo group rows in Excel by a cell value, first sort the list by the column containing that…
- Data Validation and Quality Assurance in ExcelIn Excel, data validation limits what people can enter in a cell, while quality assurance (QA) is the…
- Freelance Videographer Invoice Template ExcelYes, you can create a professional freelance videographer invoice in Excel using a simple layout with columns for…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.