FORECAST.LINEAR predicts a future y-value by fitting a straight line to known x and y pairs. It returns the y-value on that line for the x-value you specify.
=FORECAST.LINEAR(x, known_ys, known_xs)What does FORECAST.LINEAR do?
FORECAST.LINEAR is a statistical function that uses linear regression to predict a value. You give it a target x-value and two ranges of known data (known y-values and known x-values), and it calculates where a straight line through those points would land at your target x. The result is a single number: the predicted y.
This function is useful whenever you have a clear trend and need a quick estimate. Instead of building a chart with a trendline or running a full regression analysis, you can get a prediction with one formula. It works in all modern versions of Excel and is part of the Statistical function category.
Imagine you track monthly sales and want to estimate next month's revenue based on the last six months. Or you have temperature readings and want to predict energy usage. FORECAST.LINEAR gives you a fast, formula-based answer that updates automatically when your data changes.
When to use FORECAST.LINEAR
- Estimating next month's sales from historical monthly figures.
- Predicting crop yield based on rainfall amounts.
- Forecasting energy consumption from temperature data.
- Projecting test scores from study hours.
- Estimating delivery time from distance travelled.
- Predicting website traffic from advertising spend.
FORECAST.LINEAR syntax
=FORECAST.LINEAR(x, known_ys, known_xs)| Argument | Required? | What to enter |
|---|---|---|
x | Required | The data point for which you want to predict a value. This is the x-value you are forecasting for. Example: 7 (if you want the prediction for the 7th month). |
known_ys | Required | The dependent values you already know. These are the y-values that correspond to the known x-values. Must be a range or array of numbers. Example: B2:B7 (sales figures). |
known_xs | Required | The independent values you already know. These are the x-values that correspond to the known y-values. Must be a range or array of numbers of the same size as known_ys. Example: A2:A7 (month numbers). |
What it returns: The predicted y-value for the given x, based on a linear regression line through the known data points. The result is a number.
FORECAST.LINEAR examples
1 Example 1: Predict Sales for Month 7
You have monthly sales for months 1 to 6 and want to predict month 7. The formula uses the month numbers as known_xs and the sales as known_ys, then forecasts for x=7. It fits a straight line to the six data points and returns the y-value on that line at x=7. The result is 1794.666667, meaning sales are expected to be 1,550 in month 7 if the trend continues.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Month | Sales | |||
| 2 | 1 | 1200 | 1794.666667 | ||
| 3 | 2 | 1350 | |||
| 4 | 3 | 1420 | |||
| 5 | 4 | 1500 | |||
| 6 | 5 | 1600 | |||
| 7 | 6 | 1700 | |||
| 8 |
2 Example 2: Predict Test Score from Study Hours
A teacher has data on hours studied and the corresponding test scores for five students. To predict the score for a student who studies 6 hours, the formula uses hours as known_xs and scores as known_ys, with x=6. It calculates the linear trend and returns the predicted score. The result is 85.59459459, so a student studying 6 hours is expected to score around 85.59459459.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Hours | Score | |||
| 2 | 2 | 65 | 85.59459459 | ||
| 3 | 3 | 70 | |||
| 4 | 4 | 75 | |||
| 5 | 5 | 82 | |||
| 6 | 7 | 90 | |||
| 7 |
3 Example 3: Forecast Energy Use from Temperature
An office manager records daily temperature and electricity usage for six days. To estimate usage on a day forecast to be 25°C, the formula uses temperature as known_xs and usage as known_ys, with x=25. It fits a line to the six points and returns the predicted usage. The result is 463.3333333, so expect about 463.3333333 kWh when the temperature is 25°C.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Temp (°C) | Usage (kWh) | |||
| 2 | 20 | 400 | 463.3333333 | ||
| 3 | 22 | 420 | |||
| 4 | 24 | 450 | |||
| 5 | 26 | 480 | |||
| 6 | 28 | 500 | |||
| 7 | 30 | 530 | |||
| 8 |
4 Example 4: Predict Delivery Time from Distance
A courier company has delivery times for various distances. To predict the time for a 7 km delivery, the formula uses distance as known_xs and time as known_ys, with x=7. It computes the linear relationship and returns the estimated time. The result is 20, so a 7 km delivery should take about 20 minutes.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Distance (km) | Time (min) | |||
| 2 | 2 | 10 | 20 | ||
| 3 | 3 | 12 | |||
| 4 | 4 | 14 | |||
| 5 | 5 | 16 | |||
| 6 | 6 | 18 | |||
| 7 |
5 Example 5: Estimate Website Traffic from Ad Spend
A marketing team tracks monthly ad spend and website visits. To estimate visits when spending 800, the formula uses ad spend as known_xs and visits as known_ys, with x=800. It calculates the trend line and returns the predicted visits. The result is 3152.380952, so spending 800 should bring about 2,500 visits.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Ad Spend | Visits | |||
| 2 | 100 | 500 | 3152.380952 | ||
| 3 | 200 | 800 | |||
| 4 | 300 | 1200 | |||
| 5 | 400 | 1600 | |||
| 6 | 500 | 2000 | |||
| 7 | 600 | 2400 | |||
| 8 |
Common FORECAST.LINEAR errors and how to fix them
| Error | Why it happens | How to fix it |
|---|---|---|
| #N/A | known_ys and known_xs have different number of data points. | Ensure both ranges contain the same number of cells and cover the same rows. |
| #VALUE! | One or more cells in known_ys or known_xs contain text instead of numbers. | Remove or convert text values to numbers in the referenced ranges. |
| #DIV/0! | The known_xs range has zero variance (all x-values are the same), making the slope undefined. | Include a range of x-values that vary. |
| #NUM! | The x argument is not a number, or the known ranges are empty. | Provide a numeric x and ensure the known ranges contain numeric data. |
Tips for using FORECAST.LINEAR
- Use FORECAST.LINEAR only when the relationship between x and y appears roughly linear; check with a scatter chart.
- Keep known_ys and known_xs ranges the same size to avoid errors.
- The function ignores text and logical values in the known ranges, but they can cause #VALUE! if not handled.
- For more advanced forecasting, consider FORECAST.ETS which handles seasonality.
- You can use cell references for x to make the formula dynamic.
- Remember that FORECAST.LINEAR is the modern replacement for the legacy FORECAST function; both work the same way.
Frequently asked questions
What is the difference between FORECAST and FORECAST.LINEAR?
They are functionally identical. FORECAST.LINEAR is the newer name introduced in Excel 2016, but FORECAST still works for compatibility.
Can FORECAST.LINEAR handle multiple x variables?
No, it only supports one independent variable. For multiple regression, use LINEST or the Analysis ToolPak.
Why do I get #N/A with FORECAST.LINEAR?
The most common cause is that known_ys and known_xs have different sizes. Make sure both ranges have the same number of cells.
Does FORECAST.LINEAR work with dates?
Yes, if the dates are stored as serial numbers. You can use date cells as known_xs and the function will treat them as numbers.
Is FORECAST.LINEAR available in Excel 2010?
No, FORECAST.LINEAR was introduced in Excel 2016. In earlier versions, use the FORECAST function instead.
Related functions
Every example on this page was recalculated by SheetSkill’s spreadsheet engine. FORECAST.LINEAR reference