How To Get Y=Mx+B On Google Sheets

Google Sheets is a powerful tool that can be used for a variety of calculations and data analysis. If you’re learning or working with linear equations, you’ll be glad to know that Google Sheets can help you with that as well. In this blog post, we’ll be demonstrating how to get the linear equation y=mx+b on Google Sheets.

What is y=mx+b?

In mathematics, y=mx+b is the equation of a straight line in slope-intercept form. ‘m’ represents the slope of the line, ‘b’ is the y-intercept, ‘x’ is the independent variable, and ‘y’ is the dependent variable.

Steps to Get y=mx+b on Google Sheets

Step 1: Prepare Your Data

First, you need to have your data ready. Your data should be in two columns: one for x-values and one for y-values.

Step 2: Insert a Scatter Plot

Click on the chart icon in the toolbar or go to Insert > Chart. In the Chart Editor panel, select Scatter chart under the Chart type section. Your scatter plot should now be visible on your Google Sheet.

Step 3: Add a Trendline

Click on the scatter plot and then click on the three-dot menu in the top right corner of the chart. Select ‘Edit chart’. In the setup tab under ‘Series’, click on ‘Add Trendline’. This will fit a line on your data following the equation y=mx+b.

Step 4: Display the Equation on the Chart

Still under the Trendline section, check the ‘Show Equation’ box. Your linear equation (y=mx+b) should now be visible on your scatter plot.

Step 5: Reading the Equation

The equation will be presented in the form y = mx + b, where m is the slope of the line and b is the y-intercept.

Using Google Sheets LINEST function for y=mx+b

If you prefer a more direct approach, you can use the built-in LINEST function in Google Sheets to calculate ‘m’ and ‘b’ directly.

=INDEX(LINEST(B2:B6, A2:A6),1,2)

The above formula will return the y-intercept ‘b’. To get the slope ‘m’, use:

=INDEX(LINEST(B2:B6, A2:A6),1,1)

Please replace ‘B2:B6’ and ‘A2:A6’ with actual cell references in your data range.


Google Sheets offers various tools and functions that can help you calculate and visualize the linear equation y=mx+b. By following the above steps or using the LINEST function, you can easily work with linear equations on Google Sheets.