How to Add Equation to Graph in Google Sheets

Cody Schneider7 min read

Adding an equation to a graph in Google Sheets transforms a simple chart into a powerful predictive tool. Instead of just seeing a relationship between your data points, the equation allows you to quantify that relationship and even forecast future outcomes. This article will walk you through, step-by-step, how to display a trendline equation directly on your Google Sheets graph.

Why Bother Adding an Equation to Your Graph?

Adding an equation onto a chart might seem like something reserved for a statistics class, but it has incredibly practical uses for marketers, business owners, and analysts. When you add a trendline and its corresponding equation, you’re unlocking a few key capabilities:

  • Predictive Forecasting: The equation gives you a model to predict future results. If you know the formula for the relationship between ad spend and sales, you can forecast your sales based on a planned ad budget.
  • Understanding Relationships: It moves you from "it looks like these two things are related" to "for every one-dollar increase in X, Y increases by exactly this much." This quantifies the impact of your efforts.
  • Clear Communication: Displaying the equation directly on the graph makes your findings self-contained and easy to share. Your colleagues or clients can see both the visual trend and the mathematical model behind it without needing a separate spreadsheet with calculations.

Step 1: Set Up Your Data for Analysis

Before you can graph anything, you need data organized in a way that Google Sheets can understand. For trend analysis, you need two columns of related numerical data: an independent variable and a dependent variable.

  • Independent Variable (X-axis): This is the variable you control or that influences the other. Examples include time, advertising spend, or website traffic.
  • Dependent Variable (Y-axis): This is the outcome or result you are measuring. Examples include sales revenue, sign-ups, or conversion rate.

For this tutorial, let’s use a classic business example: tracking monthly advertising spend against the sales revenue it generated. This helps us answer the question, "How much revenue do we get for each dollar we spend on ads?"

Make sure your data is clean, with the 'X' variable in one column and the 'Y' variable in the adjacent column. This simple setup makes the next steps quick and easy.

Step 2: Create a Scatter Chart

While Google Sheets offers many chart types, the best choice for visualizing the relationship between two numerical variables is a scatter chart. Each point on the chart represents a pair of values (e.g., the Ad Spend and Sales Revenue for a specific month), allowing you to clearly see the underlying pattern.

Here’s how to create one:

  1. Select your data range, including the headers. In our example, that would be cells A1 through B7.
  2. Click on Insert from the top menu, then select Chart.
  3. Google Sheets might default to a line or bar chart. To fix this, find the Chart editor pane on the right side of your screen.
  4. In the Setup tab of the Chart editor, click the dropdown under Chart type and choose Scatter chart.

You should now have a basic scatter plot that shows your data points. You can already see a general trend: as ad spend increases, so does sales revenue. But now it’s time to get precise.

Step 3: Add a Trendline and its Equation

This is where the magic happens. We'll add a line of best fit - known as a trendline - to our scatter plot and then tell Google Sheets to display its formula.

How to Add the Trendline and Equation:

  1. Make sure the Chart editor is open. If it’s not, just double-click on your chart.
  2. Switch from the 'Setup' tab to the Customize tab in the Chart editor.
  3. Click to expand the Series section. This is where you can format your data points and add analytical elements.
  4. Scroll down a bit within the 'Series' section and check the box next to Trendline. A line will immediately appear, cutting through your data points.
  5. Right below the Trendline checkbox, you'll see a dropdown menu for Label. It defaults to 'None.' Click this dropdown.
  6. Select Use Equation from the options.

Success! The equation for your trendline will now appear on your chart, typically as part of the legend.

Optionally, you can also check the box for Show R². R-squared is a statistical measure that tells you how well your trendline fits your data. A value closer to 1.0 means a better fit. In our example, an R² of 0.988 is extremely high, indicating that our ad spend is a very strong predictor of our sales revenue.

Step 4: Choose the Right Type of Trendline

Google Sheets offers several types of trendlines because not all relationships are linear (a perfect straight line). In the Customize > Series > Trendline section, you'll see a Type option.

Linear Trendline

This is the default and most common type. It follows the formula y = mx + b and is used when the relationship between your variables is consistently increasing or decreasing. For our ad spend example, the linear equation 11.8 * x + 5392.9 tells us:

  • Slope (m = 11.8): For every $1 we increase ad spend (x), our sales revenue (y) increases by approximately $11.80.
  • Y-Intercept (b = 5392.9): If we were to spend $0 on ads, our baseline sales would be around $5,392.90. This could represent sales from organic traffic or brand recognition.

Polynomial Trendline

A polynomial trendline is useful when the relationship between your data is a curve, not a straight line. This often happens with data that shows diminishing returns. For example, the effect of your first advertising dollars might be huge, but the impact could level off as you spend more.

To use it, simply change the trendline Type to Polynomial. You can then choose the Polynomial Degree, which determines the complexity of the curve. A degree of 2 is the simplest curve. The equation will change to a quadratic form (e.g., y = ax² + bx + c), giving you a more accurate model for curved data patterns.

Step 5: Use the Equation to Make Forecasts

Now that you have your equation, you can use it to build a simple forecasting model right in your spreadsheet.

Let's use our linear equation from the chart: Sales Revenue = 11.8 * Ad Spend + 5392.9

What if we want to know our expected sales if we spend $2,500 on ads next month?

  1. In an empty cell in your Google Sheet, type the planned ad spend, for example, 2500 in cell A10.
  2. In the cell next to it (B10), you can write the formula to calculate the forecast:

=11.8 * A10 + 5392.9

Google Sheets will calculate the result, giving you a data-backed forecast. In this case, spending $2,500 on ads would be expected to generate roughly $34,893 in sales. This is far more powerful than just guessing based on the visual trend of the graph.

Final Thoughts

Displaying an equation on your Google Sheets graph bridges the gap between raw data and actionable strategy. You've now seen how to create a scatter plot, add a trendline with its equation, and use that resulting formula to make concrete predictions about your business performance.

While this manual process in Google Sheets is useful, it can become repetitive, especially when you need to analyze data from multiple sources like Google Analytics, Shopify, or your CRM. At Graphed, we built an AI data analyst to remove this friction. Instead of clicking through menus, you can just ask a question like, "Show me a chart of Shopify sales vs. Facebook Ads spend for the last 6 months with a trendline," and Graphed will instantly generate a live dashboard for you, equation included, saving you from any manual report building.

Related Articles

How to Connect Facebook to Google Data Studio: The Complete Guide for 2026

Connecting Facebook Ads to Google Data Studio (now called Looker Studio) has become essential for digital marketers who want to create comprehensive, visually appealing reports that go beyond the basic analytics provided by Facebook's native Ads Manager. If you're struggling with fragmented reporting across multiple platforms or spending too much time manually exporting data, this guide will show you exactly how to streamline your Facebook advertising analytics.

Appsflyer vs Mixpanel​: Complete 2026 Comparison Guide

The difference between AppsFlyer and Mixpanel isn't just about features—it's about understanding two fundamentally different approaches to data that can make or break your growth strategy. One tracks how users find you, the other reveals what they do once they arrive. Most companies need insights from both worlds, but knowing where to start can save you months of implementation headaches and thousands in wasted budget.