LINEST fits a straight line (or a multiple regression) and returns slope, intercept and, optionally, R², standard errors and more — an entire regression output from one formula.
Syntax
=LINEST(known_ys, [known_xs], [const], [stats])
Argument
What it means
known_xs
One or more columns of predictors.
stats
TRUE for the full statistics block.
Examples
Example 1
=LINEST(D2:D40, B2:C40, TRUE, TRUE)
Sales explained by ad spend and price: spills a 5-row stats table.
Example 2
=INDEX(LINEST(D2:D40, B2:B40), 1)
Just the slope.
💡 Coefficients come back in reverse column order — the last x column first. Everyone gets caught by this once.