ID EN
#Statistical

LINEST

Excel Functions

Get parameters of linear trend

Syntax

EXCEL
=LINEST(known_ys, [known_xs], [const], [stats])

Arguments

Parameter Description
known_ys An array or range of dependent y values.
known_xs [optional] An array or range of independent x values.
const [optional] Boolean - normal or force the constant b to equal 0. Default is TRUE = normal calculation.
stats [optional] Boolean - return additional statistics. Default is FALSE = slope and intercept only.

Return Value

Array of values

Details

The LINEST function returns statistics for a best fit straight line through supplied x and y values. The values returned by LINEST include slope, intercept, standard error values, and more, up to 10 different statistics in total. To find the best fit of a line to the data, the LINEST function uses the "least squares" method, the standard approach in regression analysis. The LINEST function returns more than one value at a time in an array. In its most basic form, LINEST returns just intercept and slope. Optionally, LINEST can also return 10 separate statistics for the regression analysis as shown in the worksheet above. In Excel 365, which supports dynamic arrays, the array of values will spill into cells in the worksheet automatically. In other versions of Excel, you must enter the LINEST

Examples

Examples

By default, LINEST returns just two statistics, slope and intercept. For example:

EXCEL
=LINEST({1.8;5.3;8.2;12;13.5},{1;3;5;7;8}) // default
Examples

returns a 1 row by 2 column array like this:

EXCEL
{1.6726,0.1317}
Examples

Setting the stats argument to TRUE or 1 will cause LINEST to return all 10 statistics:

EXCEL
=LINEST({1.8;5.3;8.2;12;13.5},{1;3;5;7;8},TRUE,TRUE) // more stats
Examples

The result is an array with 5 rows and 2 columns:

EXCEL
{1.6726,0.1317;
0.0371,0.2017;
0.9985,0.2124;
2034.443,3;
91.7567,0.1353}

See Also

SLOPE INTERCEPT