How to Find A Line of Best Fit in Google Sheets

Google Sheets can be used to find a line of best fit by entering the data into two columns. The x-column should contain the independent variable and the y-column should contain the dependent variable. Once the data is entered, select both columns and then choose the “Chart” option. Select Line Chart from the Chart Type menu and then click the “Trendline” option. This will show the line of best fit and the equation of the line.


A line of best fit is a line that best “fits” the trend in a given dataset.

Line of best fit in Google Sheets

This tutorial provides a step-by-step example of how to create a line of best fit in Google Sheets.

Step 1: Create the Dataset

First, let’s create a fake dataset to work with:

Step 2: Create a Scatterplot

Next, we’ll create a to visualize the data.

First, highlight cells A2:B11 as follows:

Next, click the Insert tab and then click Chart from the dropdown menu:

Google Sheets will automatically insert a scatterplot:

Step 3: Add the Line of Best Fit

Next, double click anywhere on the scatterplot to bring up the Chart Editor window on the right:

Add a line of best fit in Google Sheets

The following trendline will automatically be added to the chart:

Trendline in Google Sheets

We can see that the line of best fit seems to capture the trend in the data quite well.

Above the scatterplot, we see that the equation for this line of best fit is as follows:

y = 2.8*x + 4.44

The for this line turns out to be .938. This indicates that 93.8% of the variation in the response variable, y, can be explained by the predictor variable, x.

We can also use the equation for the line of best fit to find the estimated value of y based on the value of x. For example, if x = 3 then y is estimated to be 12.84:

y = 2.8*(3) + 4.44 = 12.84

x