# LINEST

## Content

This function calculates the statistics for a line.

## Syntax

`LINEST(y, x, constant, stats)`

## Arguments

The equation for the line is y=mx+b or y=m1x1+m2x2+...+b.

This function has these arguments:

| Argument | Description |
| -------- | ----------- |
| *y* | Set of y values that are known in the relationship y=mx+b |
| x | (Optional) X is an optional set of x values that may be known in the relationship y=mx+b |
| *constant* | Logical value that specifies whether to force the constant b to equal 0. If true or omitted then b is calculated normally; if false then b is equal to 0 and the m values are adjusted so that y=mx. |
| *stats* | Logical value that specifies whether to return additional regression statistics. If true, then the additional regression statistics are returned if false or omitted then only the m-coefficients and b are returned. |

If x is omitted then x defaults to the array {1,2,3...}, that has the same dimensions as y.

## Remarks

Use the [INDEX](/spreadjs/docs/v16/formulareference/FormulaFunctions/lookup-reference-functions/FORMULA_INDEX) function to get individual elements from the returned array.

## Data Types

Accepts an array. Returns an array.

## Examples

`LINEST(A2:A7,C2:C7,,FALSE)`