how to add y mx b in google sheets

The Ultimate Guide: Add Y/MX/Operator in Google Sheets

By Joshua Smith
AD

Trying to perform engineering calculations in Google Sheets? You might need to use the formula y=mx+b at some point. This linear equation represents a straight line across a coordinate system. Here's a step-by-step guide on how to input this formula in Google Sheets.

First, let's understand the elements of y=mx+b:

Components of y=mx+b

The formula y=mx+b is composed of four parts:

AD
Math in Google Sheets: Add, Sum, Subtract, Multiply, Divide, Square
Math in Google Sheets: Add, Sum, Subtract, Multiply, Divide, Square
The Ultimate Google Sheets Keyboard Shortcut Cheat Sheet for Beginners & Pros
The Ultimate Google Sheets Keyboard Shortcut Cheat Sheet for Beginners & Pros
Master Google Sheets Math Functions Like a Pro
Master Google Sheets Math Functions Like a Pro

y: This is your dependent variable, the value you want to find. In our case, it's the result of the calculation.

m: The slope of the line. It can be positive, negative, or zero.

Google Sheets Budget Templates and Chromebook Shortcuts
Google Sheets Budget Templates and Chromebook Shortcuts
Basic Formatting in Google Sheets
Basic Formatting in Google Sheets
6 Crazy Google Sheets Formulas You Should Know
6 Crazy Google Sheets Formulas You Should Know

x: The independent variable. It's the input you provide to calculate y.

b: This is the y-intercept, the point where the line crosses the y-axis.

AD

Finding 'm'

The slope 'm' determines the direction and steepness of the line. If you have two points (x1, y1) and (x2, y2), you can find m using the formula:

ARRAYFORMULA & 5 ways to apply a formula to an entire column in Google Sheets
ARRAYFORMULA & 5 ways to apply a formula to an entire column in Google Sheets
Google Sheets Shortcut Cheat Sheet for Efficient Spreadsheets
Google Sheets Shortcut Cheat Sheet for Efficient Spreadsheets
How to Use the MOD Function in Google Sheets
How to Use the MOD Function in Google Sheets
Master XLOOKUP and MAX Formula in Google Sheets: A Complete Step-by-Step Guide with Examples
Master XLOOKUP and MAX Formula in Google Sheets: A Complete Step-by-Step Guide with Examples
Master Google Sheets Dynamic Named Ranges
Master Google Sheets Dynamic Named Ranges
The Ultimate Google Sheets Formulas Cheat Sheet
The Ultimate Google Sheets Formulas Cheat Sheet

m = (y2 - y1) / (x2 - x1)

Finding 'b'

Once you have 'm', you can find 'b' using one point (x0, y0) and the formula:

AD

b = y0 - mx0

How to Add in Google Sheets
How to Add in Google Sheets
20 Google Sheets Formulas Everyone Should Know (Save This!)
20 Google Sheets Formulas Everyone Should Know (Save This!)
Free Habit Tracker 50 Google Sheets Shortcuts Every User Must
Free Habit Tracker 50 Google Sheets Shortcuts Every User Must

Using y=mx+b in Google Sheets

Now that we know our components, let's input the formula y=mx+b in Google Sheets.

Assume we have our slope 'm' in cell A1, x-value in cell B1, and we want y in cell C1. Here's how to build the formula:

AD

In cell C1, type:

= B1 * A1 + your calculated b value or another cell with b value

AD