FORECAST.LINEAR

Short answer

Split fixed and variable cost with a straight-line fit

FORECAST.LINEAR(x, known_ys, known_xs)
Excel version
2016+
Also searched as
forecast function, linear forecast, linear regression excel, cost behavior, fixed and variable cost, semi-variable cost, forecast excel

What it returns

FORECAST.LINEAR fits a straight line through pairs of known x and y values by least squares, then returns the y value on that line for a new x. With monthly volumes as x and monthly costs as y, it answers: at a volume of 15,000 units, what does the cost line predict?

The line has two parts, and in finance both mean something:

  • The slope is the change in y for one more unit of x. Against volume, it is variable cost per unit.
  • The intercept is y when x is zero. Against volume, it is an estimate of fixed cost.

FORECAST.LINEAR replaced FORECAST in Excel 2016. The two take the same arguments and return the same result; FORECAST remains for compatibility.

It returns one value per formula. For a whole row of projections, TREND does the same fit and spills the results.

Arguments that matter

ArgumentRequiredWhat it does
xYesThe new x value to predict for. A number or date.
known_ysYesThe dependent values: what you are predicting, such as cost.
known_xsYesThe independent values: the driver, such as volume or a period number.

Note the order: y values before x values. Swapping them fits a different line, with no error.

Documented errors:

  • known_ys and known_xs of different sizes, or empty, return #N/A.
  • known_xs that are all the same value return #DIV/0!, because no line can be fitted.
  • A non-numeric x returns #VALUE!.

In a financial model

The most defensible use in FP&A is cost behavior: regressing a cost line against the activity that drives it. Warehouse cost against units shipped, support cost against tickets, utilities against production hours. The result splits a semi-variable cost into a fixed base and a per-unit rate that can then be driven by the volume forecast.

The fitted slope and intercept are assumptions with a source, and should be written onto the inputs tab with the period of data they came from, per source-stamp every assumption.

Regressing a line against time is less defensible. It assumes the past trend continues, says nothing about why, and ignores seasonality. If time is the only x available, TREND or FORECAST.ETS make the time assumption explicit, and the forecast should still be challenged against drivers.

A line only holds within the range of the data. A cost line fitted between 7,600 and 13,100 units says little about 25,000 units, where a second shift or a new building changes the fixed base. Bound the driver, per bound every driver, and say where the fit stops, per write down what the model can’t do.

Worked example

Eight months of warehouse data. Units shipped in B5:B12, warehouse cost in thousands of dollars in C5:C12.

MonthUnitsCost ($000)
18,200611
29,100662
37,600571
410,400731
511,800770
69,900702
712,500828
813,100839

Predicted cost at 15,000 units:

=FORECAST.LINEAR(15000, C5:C12, B5:B12)

Result: 938.78, or about $939,000. Note that 15,000 is above the highest month in the data, so this is a modest extrapolation and should be flagged as one.

The two components, from the same fit:

=SLOPE(C5:C12, B5:B12)
=INTERCEPT(C5:C12, B5:B12)

Slope: 0.04803, about $48 of cost per unit. Intercept: 218.37, about $218,000 of fixed cost per month. The forecast is the intercept plus slope × volume.

How well the line fits:

=RSQ(C5:C12, B5:B12)

Result: 0.988. Volume explains about 99% of the month-to-month variation in cost here. A reviewer will want to see this number, and eight data points is a small sample: report it with the sample size.

Old way vs new way

The traditional cost-accounting shortcut is the high-low method, which draws a line through the highest-volume and lowest-volume months only:

=(C12-C7)/(B12-B7)

That uses two points out of eight and is at the mercy of whichever months happen to be extremes. The regression uses all of them:

=FORECAST.LINEAR(15000, C5:C12, B5:B12)

Where it breaks

The forecast is nonsense with no error. known_ys and known_xs were entered in the wrong order, so the formula predicted volume from cost. Fix: y first, the thing you are predicting.

#N/A. The two ranges are different sizes, often because one includes a header or a total row. Fix: use Table columns, which are always the same length.

#DIV/0!. Every x value is the same, for example a fixed-volume contract. There is no variation to fit. Fix: use a different driver, or treat the cost as fixed.

The fixed cost comes out negative. The data does not include low-volume months, so the line, extended back to zero, crosses below the axis. The intercept is outside the data and is not a real fixed cost. Fix: report the slope within the observed range, and estimate fixed cost from the cost base directly.

A trend against time misses seasonality. Monthly revenue regressed on month number gives a line through peaks and troughs. Fix: use FORECAST.ETS, or regress against a seasonal driver.

Related functions

  • TREND. The same least-squares line, returning many predictions at once and supporting several drivers.
  • FORECAST.ETS. A time-series forecast that detects seasonality, for when time is the driver.
  • GROWTH. Fits an exponential curve instead of a straight line.
  • RRI. The compound growth rate between two values, a simpler projection basis than a fitted trend.
  • SLOPE, INTERCEPT and RSQ, not yet on this site, return the parts and fit of the same line.
  • The play bound every driver is how to keep a fitted line inside the range it was fitted on.

All functions