### LINEST Function Excel

##### Associated Files Download Links

In this Article

This Excel Tutorial demonstrates how to use the **Excel LINEST Function** in Excel to calculate statistics about a trendline, with formula examples.

## LINEST Function Description:

The LINEST Function Calculates statistics about a trendline fitted to known data points using the least squares method.

## Formula Examples:

Example | Formula | Result |
---|---|---|

1 | {=LINEST($B$5:$B$10,$C$5:$C$10)} |

## Syntax and Arguments:

The Syntax for the LINEST Formula is:

1 |
=LINEST(known_ys,known_xs,const,stats) |

### Function Arguments ( Inputs ):

**known_y’s** – An array of known Y values.

**known_x’s** – An array of known X values.

**const** – OPTIONAL. Logical value indicating whether to calculate B (the intercept in y = mx + b) using the least squares method (TRUE Or Ommitted) or to manually set B = 0 (FALSE).

**stats** – OPTIONAL. Return additional statistics (TRUE) or only return m (slope) and b (intercept) (FALSE or Omitted)

## Additional Notes

## LINEST Examples in VBA

You can also use the LINEST function in VBA. Type:

`application.worksheetfunction.linest(known_ys,known_xs,const,stats)`

Executing the following VBA statement

1 |
Range("D2") = Application.WorksheetFunction.LinEst(Range("A2:A8"), Range("B2:B8")) |

will produce the following results

For the function arguments (known_y’s, etc.), you can either enter them directly into the function, or define variables to use instead.

Return to the List of all Functions in Excel

## How to use the LINEST Function in Excel:

To use the AND Excel Worksheet Function, type the following into a cell:

`=AND(`

After entering it in the cell, notice how the AND formula inputs appear below the cell:

You will need to enter these inputs into the function. The function inputs are covered in more detail in the next section. However, if you ever need more help with the function, after typing “=LINEST(” into a cell, without leaving the cell, use the shortcut **CTRL + A** (**A** for **A**rguments) to open the “Insert Function Dialog Box” for detailed instructions:

For more information about the LINEST Formula visit the

Microsoft Website.