How to Graph an Equation / Function – Excel & Google Sheets

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on June 13, 2022

This tutorial will demonstrate how to graph a Function in Excel & Google Sheets.

How to Graph an Equation / Function in Excel


Set up your Table

  1. Create the Function that you want to graph
  2. Under the X Column, create a range. In this example, we’re range from -5 to 5

Starting Dataset to find Equation for X Y Axis


Fill in Y Column

Create a formula using the Function, substituting x with what is in Column B.

Formula Calculate Y Value for Equation in Excel

After using this formula for all the rows, you should have a table that looks like below.

Formulas all Values X Y Axis in Equation

Creating Scatterplot

  1. Highlight Dataset
  2. Select Insert
  3. Select Scatterplot
  4. Select Scatter with Smooth Lines

Scatterplot Chart in Excel from Equation


This will create a graph that should look similar to below.

Equation Curve Excel Function


Add Equation Formula to Graph

  1. Click Graph
  2. Select Chart Design
  3. Click Add Chart Element
  4. Click Trendline
  5. Select More Trendline Options

Creating a Trendline from an Equation in Excel


6. Select Polynomial

7. Check Display Equation on Chart

Polynomial Equation Trendline for Curve in Excel


Final Scatterplot with Equation

Your final equation on the graph should match the function that you began with.

Equation Formula on Graph in Excel


How to Graph an Equation / Function in Google Sheets

Creating a Scatterplot

  1. Using the same table that we made as explained above, highlight the table
  2. Click Insert
  3. Select Chart

Equation Table for Curve Google Sheets


4. Click on the dropdown under Chart Type

5. Select Line Chart

Line Chart for Equation Google Sheets


Adding Equation

  1. Click on Customize
  2. Select Series

Trendline Equation for Line Chart Google Sheets

3. Check Trendline

4. Under Type, Select Polynomial

5. Under Label, Select Use Equation

Polynomial Trendline and Equation for Curve in Google Sheets

Final Scatterplot with Equation

As you can see, similar to the exercise in Excel, the equation matches the function that we began with.

Equation from Google Sheets on Graph

AI Formula Generator

Try for Free