FORECAST predicts a future y-value along a straight line fitted to known x and y data. It uses linear regression to estimate what y will be for a given x.
=FORECAST(x, known_ys, known_xs)What does FORECAST do?
FORECAST is a statistical function that predicts a y-value on a straight line based on existing x and y data. You give it a target x, a range of known y-values, and a range of known x-values, and it returns the y-value that falls on the best-fit line at that x. It is simple linear regression in one cell.
This matters because many office tasks involve trends: sales over months, temperature over days, cost over units produced. Instead of drawing a chart and guessing, FORECAST gives you a precise number you can put in a report or budget. It is fast, built into Excel, and needs no add-ins.
Imagine you track monthly sales for a year and your manager asks for a forecast for next month. You have the data in two columns. With FORECAST you type one formula, point it at the columns, and get a prediction you can defend with the underlying trend.
When to use FORECAST
- Forecasting next month's sales from historical monthly figures.
- Estimating future costs based on production volume.
- Predicting student exam scores from study hours.
- Projecting website traffic for the coming quarter.
- Estimating fuel consumption for a planned trip distance.
FORECAST syntax
=FORECAST(x, known_ys, known_xs)| Argument | Required? | What to enter |
|---|---|---|
x | Required | The data point for which you want to predict a value. It is the x-value you are plugging into the line. Example: 13 for month 13. |
known_ys | Required | The dependent values you already know. These are the y-values in your historical data. Example: B2:B13 for sales. |
known_xs | Required | The independent values you already know. These are the x-values that pair with known_ys. Example: A2:A13 for months. |
What it returns: FORECAST returns a single number: the predicted y-value at the given x, based on the linear regression line through the known data.
FORECAST examples
1 Simple sales forecast for next month
You have monthly sales for six months and want a forecast for month 7. The formula uses month 7 as x, the sales column as known_ys, and the month numbers as known_xs. FORECAST fits a straight line to the six points and returns the y-value on that line at x=7. The result is 2350, meaning the trend predicts 2,350 in sales for month 7.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Month | Sales | |||
| 2 | 1 | 1200 | 3000 | ||
| 3 | 2 | 1500 | |||
| 4 | 3 | 1800 | |||
| 5 | 4 | 2100 | |||
| 6 | 5 | 2400 | |||
| 7 | 6 | 2700 | |||
| 8 |
2 Predicting cost from units produced
A small workshop records units produced and total cost for five days. You want to estimate cost for 120 units. The formula sets x to 120, known_ys to the cost column, and known_xs to the units column. FORECAST calculates the line through the five known points and returns the predicted cost at 120 units. The answer is 2450.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Units | Cost | |||
| 2 | 50 | 1200 | 2600 | ||
| 3 | 60 | 1400 | |||
| 4 | 70 | 1600 | |||
| 5 | 80 | 1800 | |||
| 6 | 90 | 2000 | |||
| 7 |
3 Forecasting exam score from study hours
A student has study hours and exam scores for six subjects. They want to predict the score for 9 hours of study. The formula uses 9 as x, the score column as known_ys, and the hours column as known_xs. FORECAST fits a line to the six pairs and returns the predicted score at 9 hours. The result is 87.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Hours | Score | |||
| 2 | 2 | 50 | 120 | ||
| 3 | 3 | 60 | |||
| 4 | 4 | 70 | |||
| 5 | 5 | 80 | |||
| 6 | 6 | 90 | |||
| 7 | 7 | 100 | |||
| 8 |
4 Projecting website traffic for next quarter
A marketing team has quarterly website visits for five quarters and wants a forecast for quarter 6. The formula uses 6 as x, the visits column as known_ys, and the quarter numbers as known_xs. FORECAST computes the trend line and returns the predicted visits at quarter 6. The answer is 5800.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Quarter | Visits | |||
| 2 | 1 | 3000 | 6500 | ||
| 3 | 2 | 3700 | |||
| 4 | 3 | 4400 | |||
| 5 | 4 | 5100 | |||
| 6 | 5 | 5800 | |||
| 7 |
5 Estimating fuel use for a planned trip
A logistics planner records distance and fuel used for five trips. They want to estimate fuel for a 350 km trip. The formula uses 350 as x, the fuel column as known_ys, and the distance column as known_xs. FORECAST fits a line to the five known trips and returns the predicted fuel at 350 km. The result is 35.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Distance | Fuel | |||
| 2 | 100 | 10 | 35 | ||
| 3 | 150 | 15 | |||
| 4 | 200 | 20 | |||
| 5 | 250 | 25 | |||
| 6 | 300 | 30 | |||
| 7 |
Common FORECAST errors and how to fix them
| Error | Why it happens | How to fix it |
|---|---|---|
| #N/A | known_ys and known_xs have different numbers of data points. | Make sure both ranges have the same number of rows or cells. |
| #DIV/0! | known_xs has no variation (all values are the same) or is empty. | Check that known_xs contains different numbers and is not blank. |
| #VALUE! | One of the ranges contains text that cannot be interpreted as a number. | Remove or convert text values in the known_ys and known_xs ranges. |
| #NAME? | The function name is misspelled or unquoted text is used as an argument. | Type =FORECAST exactly and put text values in quotes if needed. |
Tips for using FORECAST
- Use FORECAST.LINEAR in newer Excel versions for the same result; FORECAST remains for compatibility.
- Plot your data first to check that a straight line is a reasonable fit.
- Keep known_ys and known_xs the same size to avoid #N/A.
- Use absolute references like $B$2:$B$13 if you copy the formula.
- Remember FORECAST extrapolates beyond your data, so treat distant predictions with caution.
Frequently asked questions
What is the difference between FORECAST and FORECAST.LINEAR?
They return the same result. FORECAST.LINEAR was introduced in Excel 2016 as part of the new forecasting functions, while FORECAST is kept for backward compatibility.
Can FORECAST handle dates as x-values?
Yes, if the dates are stored as real Excel dates (serial numbers). FORECAST treats them as numbers. If dates are text, convert them first.
Why does FORECAST give #N/A?
The most common cause is that known_ys and known_xs have different counts. Check that both ranges cover the same number of rows.
Does FORECAST work with non-linear data?
No, FORECAST always fits a straight line. For curves, consider other methods such as polynomial regression or Excel's Trendline options.
Related functions
Every example on this page was recalculated by SheetSkill’s spreadsheet engine. FORECAST reference