Trend Lines – How to Add Line of Best Fit in Google Sheets

Last updated December 9, 2021

Visualizing data using charts and graphs can be a great way to understand your data and relationships between the variables in the data.

Moreover, adding a trend line (also called the line of best fit) to the chart can help you gain a deeper understanding of the chart.

In this tutorial I will show you how to add a line of best fit in Google Sheets, to help you gain better insights into your data.

What is a Line of Best Fit?

A trend line, or a ‘line of best fit’ is one that is superimposed on a chart to understand trends within the data.

These lines can help you understand the direction of the data, make forecasts and understand relationships between data elements.

For example, if you look at the scatter chart below, you can somewhat tell how the data points are distributed but it’s hard to tell if there’s an upward or downward trend. It is also a little tough to make proper sense of the distribution.

Scatter chart ad vs sales

What happens if I add a trendline to this chart?

Line of Best Fit in scatter chart in google sheets

Adding a trend line, as shown above, helps bring a lot of things into perspective.

We can now see that the data is moving in an upward direction.

We can also extrapolate the line to make predictions about future data points, and I can tell which data points are outliers, or completely far away from the general trend.

Trend lines can be added to bar, line, column, or scatter charts. In the next section I will show you how to add a trendline in Google Sheets to fit with a scatter chart.

How to Add a Line of Best Fit in Google Sheets

Before I show you how to add a line of best fit, let us first quickly go over how you can create a chart for the data shown below:

Dataset to create line of best fit

In the above image, I have data on the number of times ads were posted and the number of sales made.

To visualize this type of data, a scatter chart would be a great option.

Here’s how you can quickly use this data to create a scatter chart in Google Sheets.

Creating a Scatter Chart in Google Sheets

To create a scatter chart based on our given data, follow the steps below:

  1. Select the data range, including the column headers. In our case, select the range A1:B22.
  2. Click on the Insert menu from the menu bar.
Click on Insert
  1. Select the Chart option from this menu.
Click on Chart option in Google Sheets
  1. You will see a chart displayed on the worksheet and a Chart Editor sidebar on the right side of the window.
chart editor of the scatter chart
  1. Google usually attempts to predict and recommend a chart depending on your selected data. If the chart displayed is not a scatter chart, then go to step 6. Otherwise, stop here.
  2. To convert your displayed chart to a scatter chart, select the Setup tab from the Chart Editor and click on the drop-down menu under ‘Chart Type’.
  3. From the chart options, select “Scatter Chart”, which you should be able to find under the Suggested or Other category.
change the chart type to scatter chart

You should now see a Scatter chart on your worksheet. Next, it’s time to add a line of best fit so you can understand the trends in your data.

How to Find the Line of Best Fit on Google Sheets

There is no Google Sheets line of best fit equation you have to use. You just have to make some customizations to the chart.

The Chart editor sidebar consists of two tabs – Setup and Customize. The Customize tab has different options to help you customize different chart settings.

To add a line of best fit to the scatter chart that I created, you need to access this Customize tab. Follow the steps below:

  1. Click on the Customize tab of the Chart Editor.
click on customize in chart editor
  1. Select the Series drop down menu.
click on series in chart editor
  1. If you scroll down the drop down menu, you will see three checkboxes.
three checkboxes in the customize option in chart editor
  1. Select the ‘Trend line’ checkbox.
select the trendline option

This will display a trend line (or line of best fit) across your scatter chart. 

Line of Best Fit in scatter chart in google sheets

In our example, you will notice the trend chart shows an upward trend. That means as the number of ads are increased, sales start going up.

Making Changes to the Trend Line

Now that you know how to find the lineIf you want to further customize the trend line, here’s what you need to do. Under the trend line checkbox, there are a number of options to customize the trend line. For example, you can:

  1. Change the type of trend line. You have the option to select linear, exponential, polynomial, logarithmic, power series, and moving average trend lines.
  2. Change the line color.
  3. Change the opacity and thickness of the trend line.
  4. Change the label for the trend line.
  5. Display the R2 value. This value helps you see how closely the trend line fits the data. The closer this value is to 1, the closer the fit.
Trendline options
  1. If you select Polynomial as your trend line type, you will also get the option to select the polynomial degrees.
select the polynomial degree
  1. If you select Moving Average as your trend line type, you will get the option to select the type of average, i.e. Trailing or Centered. You can also select the number of periods for the Moving Average trend line.
moving average trend line settings

Play around with the different options until you finally obtain a trend line that provides you with enough insight on your data.

In this tutorial, I showed you how to add a line of best fit in Google Sheets to analyze and make effective inferences about your data.

The line of best fit (or trend line) can help you observe trends and patterns in your data, can help you understand how closely your data points relate to one another and it can help you identify outliers in the data, which would have been otherwise difficult to find out.

I hope this tutorial was helpful for you.

Other Google Sheets tutorials you may like:



Google Sheets and Microsoft Excel Expert.

Leave a Comment