Skip to content
FastTool

How to get the uncertainty of a slope with LINEST

Get the standard errors of the slope and intercept from one LINEST formula, and see when they understate your real uncertainty.

Updated · Uses the free Line of Best Fit with Error Bars, which runs in your browser

Short answer

Type =LINEST(B2:B7, A2:A7, TRUE, TRUE) into a cell with five empty rows and two empty columns, putting y first and x second. Row 1 returns slope m (left) and intercept c (right); row 2 returns their standard errors σ_m (left) and σ_c (right). To pull just the slope uncertainty into one cell, use =INDEX(LINEST(B2:B7, A2:A7, TRUE, TRUE), 2, 1). Keep in mind that LINEST measures point scatter only and ignores your Δx and Δy error bars.

Open the Line of Best Fit with Error Bars

Worked example: reading every cell of the 5×2 LINEST grid

Suppose you measure current I in milliamps (B2:B7) through a 220 Ω resistor at six voltages V from 1.00 V to 6.00 V (A2:A7). The six pairs are (1.00, 4.6), (2.00, 9.0), (3.00, 13.7), (4.00, 18.1), (5.00, 22.8) and (6.00, 27.2). Your voltmeter reads to ± 0.05 V and your milliammeter reads to ± 0.8 mA.

In Google Sheets or a current Microsoft 365 Excel, enter =LINEST(B2:B7, A2:A7, TRUE, TRUE) and press Enter so the 5×2 table spills automatically. In an older Excel that doesn’t spill, select a 5×2 block first and press Ctrl+Shift+Enter. Google’s LINEST page lists the same statistics in the same order as Microsoft’s.

All 10 values returned by =LINEST(B2:B7, A2:A7, TRUE, TRUE) on the resistor dataset
Row Column 1 (left) Value Column 2 (right) Value
Row 1 Slope m (mA/V) 4.537143 Intercept c (mA) 0.020000
Row 2 Slope standard error σ_m 0.020996 Intercept standard error σ_c 0.081766
Row 3 Coefficient of determination R² 0.999914 Residual standard error s_y (mA) 0.087831
Row 4 F statistic 46698.96 Degrees of freedom df = n − 2 4
Row 5 Regression sum of squares SS_reg 360.2491 Residual sum of squares SS_resid 0.030857

Rows 1 and 2 give m = 4.54 ± 0.02 mA/V and c = 0.02 ± 0.08 mA. To pick single cells without spilling all 10 values across your sheet, wrap LINEST inside INDEX:

  • Slope m: =INDEX(LINEST(B2:B7, A2:A7, TRUE, TRUE), 1, 1) returns 4.5371.
  • Slope uncertainty σ_m: =INDEX(LINEST(B2:B7, A2:A7, TRUE, TRUE), 2, 1) returns 0.0210.
  • Intercept c: =INDEX(LINEST(B2:B7, A2:A7, TRUE, TRUE), 1, 2) returns 0.0200.
  • Intercept uncertainty σ_c: =INDEX(LINEST(B2:B7, A2:A7, TRUE, TRUE), 2, 2) returns 0.0818.

Why LINEST can understate your real uncertainty by a factor of ten

Check row 3, column 2: the readings scatter by about s_y = 0.088 mA around the line. The meter’s accuracy is ± 0.8 mA. Ordinary least squares calculates σ_m = s_y / √Σ(x_i − x̄)² from point scatter alone. Six unusually straight points therefore give σ_m = ± 0.021 mA/V, nearly ten times tighter than the meter itself.

Open this resistor dataset in the tool (with R = 1000/m set under Use the slope) to compare all four methods:

Same six resistor readings fitted with and without instrument error bars (ΔV = 0.05 V, ΔI = 0.8 mA)
Method What sets the uncertainty Slope m (mA/V) Resistance R = 1000/m (Ω)
Least squares (LINEST) Scatter of points around the line only 4.54 ± 0.02 220.4 ± 1.0
Weighted (1/Δy²) Vertical error bars ΔI = 0.8 mA 4.54 ± 0.19 220 ± 9
York Both ΔV = 0.05 V and ΔI = 0.8 mA 4.54 ± 0.20 220 ± 10
Max/min Steepest (4.94) and shallowest (4.12) lines inside error boxes 4.5 ± 0.4 220 ± 20

Quoting R = 220.4 ± 1.0 Ω from LINEST implies 0.45% precision from readings whose error bars span ± 3% to ± 17%. Whenever reduced chi-squared sits far below 1 (here 0.012), use Weighted, York or Max/min instead.

How to turn slope uncertainty into the uncertainty of your final answer

Often the quantity you want is a function of the gradient rather than the gradient itself. Current is in milliamps and voltage in volts, so resistance is R = 1000 / m. The fractional uncertainty of R then equals that of m:

  • Formula: ΔR = |dR / dm| × Δm = (1000 / m²) × Δm, or equivalently ΔR = R × (Δm / m).
  • From LINEST: (1000 / 4.5371²) × 0.0210 = 1.02 Ω, giving 220.4 ± 1.0 Ω.
  • From Weighted fit: (1000 / 4.5371²) × 0.1912 = 9.29 Ω, giving 220 ± 9 Ω.
  • From Max/min lines: (1000 / 4.5371²) × 0.4106 = 19.9 Ω, giving 220 ± 20 Ω.

Type R = 1000/m into Use the slope › Formula to get that propagation automatically. If your final formula combines m ± Δm with other measurements, such as wire diameter and length, enter them together in the Uncertainty Propagation Calculator.

Common LINEST mistakes

  • Putting x before y. Typing =LINEST(A2:A7, B2:B7, TRUE, TRUE) fits voltage on current and gives 0.2204 ± 0.0010 V/mA instead of 4.54 ± 0.02 mA/V.
  • Omitting the fourth argument. =LINEST(B2:B7, A2:A7) leaves stats as FALSE and returns only row 1 without uncertainties.
  • Setting the third argument to FALSE by habit. Forcing c = 0 gives 4.542 ± 0.008 mA/V and hides any zero-offset error on the meter.
  • Selecting header labels or blank rows. Keep them out of both ranges: select only the cells that hold your readings.
  • Treating σ_m as a 95% confidence interval. Row 2 is one standard error; multiply by t_(0.975, 4) = 2.776 for a 95% interval at df = 4.

When a two-column fit is the wrong tool

If your equation has several predictors at once—such as y = b₁x₁ + b₂x₂ + c in multiple regression—stay with spreadsheet LINEST. Passing a multi-column known_x block fits every predictor together and lists their slopes in reverse column order across row 1.

Sources

Spotted a mistake in this guide? Email contact@fasttool.app. We reply within 7 business days.

Open the Line of Best Fit with Error Bars