Google Sheets LINEST Function: Syntax, Examples & Tips

The LINEST function calculates the statistics for a linear regression model, providing slope, intercept, and other regression metrics.
Google Sheets
LINEST(known_data_y, [known_data_x], [calculate_b], [verbose])

One free generation or explanation per browser, shared across Excel and Google Sheets. Account usage limits apply afterward.

On this page
  1. Parameters
  2. What is a LINEST?
  3. A Practical Example
  4. LINEST Formula
  5. Result of the Formula
  6. Why Use LINEST?
  7. Key Takeaways:
  8. Example use case

Parameters

known_data_y:
The dependent variable data that you want to analyze, typically a range of cells containing numerical values.

known_data_x:
(Optional) The independent variable data, which can be a range of cells containing numerical values that correspond to the known_data_y. If omitted, the function assumes a single variable.

calculate_b:
(Optional) A logical value (TRUE or FALSE) that specifies whether to calculate the y-intercept (b) of the regression line. If TRUE or omitted, the y-intercept is calculated; if FALSE, it is set to zero.

verbose:
(Optional) A logical value (TRUE or FALSE) that specifies whether to return additional regression statistics. If TRUE, the function returns an array with additional information; if FALSE or omitted, it returns only the slope and y-intercept.

What is a LINEST?

The LINEST function in Google Sheets is a statistical tool used to calculate the statistics for a linear regression line, which is a straight line that best fits a set of data points. This function can return multiple values, including the slope, y-intercept, and other regression statistics, making it a valuable resource for data analysis and forecasting.

In simpler terms, LINEST allows you to analyze the relationship between two variables and predict future values based on that relationship.

A Practical Example

Imagine you are analyzing the sales performance of a product over several months:

Sales Data Table:

MonthSales
1200
2250
3300
4350
5400

You want to determine the trend of sales over these months and predict future sales.

LINEST Formula

To achieve this, you would use the LINEST function as follows:

Google Sheets
=LINEST(B2:B6, A2:A6, TRUE, TRUE)

In this formula:

  • B2:B6 is the range containing the Sales data.
  • A2:A6 is the range containing the Month data.
  • The first TRUE indicates that the function should calculate the y-intercept.
  • The second TRUE indicates that the function should return additional regression statistics.

Result of the Formula

When you apply the LINEST formula, the output will provide you with the slope and y-intercept of the regression line, along with other statistics like the correlation coefficient and standard error.

For example, the output might look like this:

SlopeInterceptR^2Standard Error
501500.9810

This means that for every additional month, sales are expected to increase by 50 units, starting from a base of 150 units.

Why Use LINEST?

LINEST is beneficial because it provides a comprehensive analysis of linear relationships in your data. It allows you to understand trends and make predictions based on historical data. Additionally, it offers a way to quantify the strength of the relationship between variables through the R-squared value.

Key Takeaways:

  • LINEST: A powerful function for performing linear regression analysis in Google Sheets.
  • Multiple Outputs: Returns slope, y-intercept, and other regression statistics for in-depth analysis.
  • Trend Analysis: Helps in understanding trends and making predictions based on historical data.
  • Common Use Cases: Ideal for sales forecasting, financial analysis, and any scenario where understanding relationships between variables is necessary.

LINEST is an essential function for anyone working with data analysis in Google Sheets, providing a robust way to enhance your analytical capabilities.

Happy analyzing!

Example use case

You have a dataset with sales data in Column A (months) and Column B (sales figures). Use the LINEST formula to analyze the relationship between time and sales, allowing you to predict future sales trends based on historical data.

Need more help with Google Sheets formulas?

Sign up for Better Analyst and get unlimited AI-powered formula generation, explanations, and advanced data analysis.

Explore all Google Sheets formulas

Browse our complete library of Google Sheets formula guides

Compare your options

Decide with evidence, not a sales pitch.

Open a neutral research prompt in the AI tool you already use. Compare capabilities, limitations, and fit before you choose.

  1. 01ChatGPTOpen a balanced comparison prompt in ChatGPT.
  2. 02ClaudeOpen the same research prompt in Claude.
  3. 03PerplexityResearch the comparison with linked web sources.

AI answers can be incomplete. Check source links, current pricing, and product documentation before deciding.