FORECAST.LINEAR function

FORECAST.LINEAR returns a predicted y-value by fitting a straight line through known x/y data points and extrapolating to a new x.

=FORECAST.LINEAR(x, known_ys, known_xs)

Generate a FORECAST.LINEAR formula

Describe what you need. The generator will reach for FORECAST.LINEAR where FORECAST.LINEAR is the right tool, and tell you when it is not.

How to get a better answer
  • Name your columns by letter and by header: "column F (Net Value)" beats "the amount column".
  • State every condition, including the negatives — "not cancelled" changes the formula's shape.
  • Say where the data starts if it is not row 1, and whether it will grow.
  • Check the settings above match your spreadsheet: the wrong argument separator is a syntax error on your machine.

Arguments

How FORECAST.LINEAR reads its arguments
xrequiredknown_ysrequiredknown_xsrequiredFORECAST.LINEAR
ArgumentRequiredDescription
xRequiredThe x-value for which you want a forecast. Can be any number, including values beyond your historical range (extrapolation).
known_ysRequiredArray of known y-values (dependent variable, typically the outcome you're forecasting). Must be numeric and match the length of known_xs.
known_xsRequiredArray of known x-values (independent variable, typically time or another driver). Must be numeric and the same length as known_ys.

Returns

A single number representing the forecasted value based on linear regression.

Availability

Excel: All · Google Sheets: Supported

Worked examples

1. Forecast warehouse stock level for next week

WeekOn Hand
1600
2555
3507
4455
5400
=FORECAST.LINEAR(6, {600, 555, 507, 455, 400}, {1, 2, 3, 4, 5})

Result: 342

Over five weeks, inventory declined by roughly 65 units per week. The function calculates this trend and projects week 6 stock at 342 units. This helps procurement determine when to place the next replenishment order before hitting the reorder point (typically 200 units).

2. Forecast rising sales demand for future days

DayUnits Sold
140
245
350
455
560
=FORECAST.LINEAR(8, {40, 45, 50, 55, 60}, {1, 2, 3, 4, 5})

Result: 75

Daily sales show a steady increase of 5 units per day (a clear linear trend). Extrapolating to day 8 predicts 75 units sold. Warehouse managers use this to anticipate restocking needs and ensure sufficient safety stock before demand peaks.

3. Estimate unit cost decrease based on cumulative orders

Units OrderedUnit Cost
100032
200031.5
300031
400030.5
=FORECAST.LINEAR(5000, {32.00, 31.50, 31.00, 30.50, 30.00}, {1000, 2000, 3000, 4000})

Result: 29.5

Suppliers often grant volume discounts; here, each additional 1,000 units ordered reduces cost by $0.50. When planning a 5,000-unit order, the formula predicts a unit cost of $29.50, enabling accurate budget forecasting for procurement.

Common errors

Which FORECAST.LINEAR error are you seeing?
FORECAST.LINEAR returned an error#DIV/0!
Ensure known_xs contains at least two different values. If tracking a constant (e.g., unit cost never changes), use AVERAGE or a fixed cell reference instead.
#VALUE!
Check that all inputs are numeric. Convert text numbers with VALUE(), remove spaces, and exclude any cells containing text labels or errors.
#N/A
Verify both arrays contain exactly the same number of data points. If using ranges (A1:A5 and B1:B6), adjust so both include the same row count.
ErrorWhy it happensHow to fix it
#DIV/0!All values in known_xs are identical, so the regression line has no slope and cannot be calculated.Ensure known_xs contains at least two different values. If tracking a constant (e.g., unit cost never changes), use AVERAGE or a fixed cell reference instead.
#VALUE!One or more cells in x, known_ys, or known_xs contain text, empty cells, or non-numeric data (e.g., a date stored as text or a cell with a formula error).Check that all inputs are numeric. Convert text numbers with VALUE(), remove spaces, and exclude any cells containing text labels or errors.
#N/AThe known_ys and known_xs arrays have different lengths, or one of them is empty.Verify both arrays contain exactly the same number of data points. If using ranges (A1:A5 and B1:B6), adjust so both include the same row count.

Tips and when to use something else

  • Use FORECAST.LINEAR when your historical data shows a clear straight-line trend. If the data curves or has strong outliers, the forecast will be inaccurate; plot your data first to verify linearity.
  • FORECAST.LINEAR predicts one value per call. To forecast many x-values at once, use TREND, which returns an array of predictions in a single formula.
  • The function assumes no causal relationship—it simply extends a trend mathematically. Real-world shocks (supply disruptions, seasonal patterns) can invalidate forecasts.
  • When forecasting inventory, always pair the result with safety stock buffers and reorder-point logic; FORECAST.LINEAR is a trend tool, not a replenishment decision-maker.

Frequently asked questions

How accurate is FORECAST.LINEAR?
Accuracy depends entirely on whether your historical data truly follows a linear pattern. If points scatter randomly around a line, accuracy is poor. Check by plotting known_xs vs known_ys; if they form a tight trend, the forecast is more reliable. Use the R² value from LINEST to quantify fit.
Can I forecast multiple values without writing separate formulas?
Yes. Use TREND instead, which takes an array of x-values and returns an array of predictions in one call. For example, =TREND(known_ys, known_xs, {6,7,8}) forecasts three values simultaneously.
What if my known_xs values are dates?
Dates work as long as they're stored as numbers (not text). Excel/Sheets internally convert dates to serial numbers, so =FORECAST.LINEAR(43000, B:B, A:A) will forecast the y-value at a future date. Ensure your date column is formatted as a date for clarity.
Is FORECAST.LINEAR the same as FORECAST?
Yes. FORECAST.LINEAR is the modern name (Excel 2016+, Google Sheets). The older FORECAST function still works but is now considered legacy. Use FORECAST.LINEAR for new sheets to stay current.

Need a different formula?

The full generator is not scoped to one function — describe any spreadsheet problem and it will pick.

Open the formula generator

Reviewed 2026-09-17