How to Graph a Function in Excel

Cody Schneider8 min read

Trying to visualize a mathematical equation doesn't mean you need to buy expensive calculus software. Microsoft Excel, the tool you already use every day, is more than capable of transforming any function into a clean, precise graph. This guide will walk you through the entire process, showing you how to set up your data, enter formulas, and create professional-looking charts for linear, quadratic, and even trigonometric functions.

Setting Up Your Excel Sheet for Graphing

Before you can graph anything, you need to give Excel the raw data it needs. Every function relies on an input value (x) to generate an output value (y). Our first step is to create two columns that will serve as the coordinates for our graph.

Step 1: Create Columns for Your X and Y Values

Start with a blank worksheet. It’s a good practice to label your columns so you know what you’re looking at. In cell A1, type x. In cell B1, type y. These headers will also help Excel automatically create labels for your chart later on.

Step 2: Populate Your X-Values

The "x" column represents the independent variable - you get to pick which values to plot on the horizontal axis. You need a good range of values to see the full shape of your function's graph.

Let's create a series of numbers from -10 to 10. You could type them out one by one, but there’s a much faster way:

  • In cell A2, type -10.
  • In cell A3, type -9.
  • Now, select both cells (A2 and A3). You'll see a small green square at the bottom-right corner of your selection. This is called the "fill handle."
  • Click and drag the fill handle down. Excel will see the pattern you started (-10, -9, ...) and automatically continue it. Drag it down until you reach cell A22, which should populate with the number 10.

You now have a clean set of x-values ready for any function you want to graph.

Example 1: Graphing a Simple Linear Function (y = 2x + 5)

A simple straight line is the best place to start. For this example, we’ll use the function y = 2x + 5. Our goal is to tell Excel to calculate the "y" value for every corresponding "x" value in our list.

Step 1: Enter the Formula for Your Y-Values

The magic happens with cell references. Instead of typing the number "x" into your formula, you'll point Excel to the cell containing the x-value.

  • Click on cell B2, which is the first empty cell in our "y" column.
  • Type the equals sign (=) to start the formula.
  • Now, translate the function y = 2x + 5 into Excel's language. It should be =2*A2+5. You can either type "A2" or simply click on cell A2 after you type the asterisk.
  • Press Enter. Excel will calculate the result: 2*(-10) + 5 = -15.
=2*A2+5

Step 2: Apply the Formula to All X-Values

Just like we did for the x-values, we’ll use the fill handle to automatically apply this formula to the entire range.

  • Click back on cell B2.
  • Click and drag the green fill handle at the bottom-right corner all the way down to cell B22.

As you drag, Excel intelligently updates the formula for each row. The formula in B3 will become =2A3+5, in B4 it will be =2A4+5, and so on. Your spreadsheet should now be showing all the calculated x- and y-coordinates.

Step 3: Insert the Chart

Now for the fun part: creating the graph. The best chart type for graphing a function is a Scatter chart, which plots x-y coordinates perfectly.

  • Select all your data, including the headers. You can click on cell A1 and press Ctrl + Shift + Down Arrow and then Ctrl + Shift + Right Arrow to quickly select it all.
  • Go to the Insert tab in the ribbon.
  • In the Charts section, look for the icon that looks like a plot of dots and click it. This is the Scatter or Bubble Chart option.
  • From the dropdown menu, choose Scatter with Smooth Lines. This option connects your dots in a fluid line, which is exactly what we want for a mathematical function.

Excel will instantly generate a chart that visually represents your function - in this case, a perfect straight line.

Example 2: Graphing a Quadratic Function (y = x² + 2x - 3)

What about a curved line, like a parabola? The process is exactly the same - only the formula changes. Let's map out the quadratic function y = x² + 2x - 3.

If you're following along, you can clear the existing formulas from your 'y' column, or start a new sheet. We'll reuse the same x-values from -10 to 10.

Step 1: Enter the Quadratic Formula

In Excel, the caret symbol (^) is used to denote an exponent (power of).

  • Click on cell B2.
  • Type in the formula: =A2^2+2*A2-3
  • Press Enter. You should see the result 77.
=A2^2+2*A2-3

Step 2: Apply and Graph

Once again, use the fill handle in cell B2 to drag the formula down to B22. This populates all the output values for your quadratic function.

With your data still selected, follow the same graphing steps: Insert > Charts > Scatter > Scatter with Smooth Lines. Your beautiful U-shaped parabola will appear on the worksheet.

Example 3: Graphing a Trigonometric Function (y = sin(x))

Excel even comes with built-in functions for trigonometry, like SIN, COS, and TAN. Let's plot a classic sine wave. One important detail: Excel's trigonometric functions work in radians, not degrees. For this example, we’ll plot values from 0 to 2π (a full circle).

  • In cell A2, type 0.
  • To get an accurate curve, let's step up in small increments. We can use Excel's PI() function. In cell A3, enter the formula =A2+PI()/12. This adds 1/12th of π for each step.
  • Use the fill handle on A3 to drag down until you get a value close to 6.28 (which is roughly 2π). This should be around cell A26.
  • Now for the Y-values. In cell B2, use Excel's built-in SIN function: =SIN(A2).
  • Press Enter and drag the fill handle down to B26.

When you create the Scatter with Smooth Lines graph, you'll see a perfect sine wave that oscillates smoothly between 1 and -1.

Making Your Graph Look Professional

A basic chart gets the job done, but with a few tweaks, you can make it much clearer and more presentable. When your chart is selected, two new tabs will appear in the ribbon: Chart Design and Format.

Adding Chart Titles and Axis Labels

A graph without labels is just a line. Tell your audience what they’re looking at.

  • With the chart selected, go to the Chart Design tab.
  • On the far left, click Add Chart Element.
  • Go to Chart Title > Above Chart to add a main title.
  • Go to Axis Titles > Primary Horizontal to label your x-axis.
  • Go to Axis Titles > Primary Vertical to label your y-axis.

Simply click on the new text boxes that appear on your chart to type in your desired labels.

Adjusting the Axis Range

Sometimes Excel's default axis range isn't ideal. You can manually set the minimum and maximum boundaries.

  • Double-click on the vertical or horizontal axis numbers in your chart.
  • A Format Axis pane will open on the right side of your screen.
  • Here, you can manually type in a new Minimum and Maximum value for the bounds to zoom in or out on specific areas of your graph.

Formatting the Line and Markers

Want a thicker line or a different color? Just right-click on the function line in your chart and select Format Data Series.... This will open the formatting pane where you can customize:

  • Line Color & Style: Edit the color, increase the width, or change it to a dashed line.
  • Markers: By default, charts with smooth lines hide the markers. You can enable them and customize their shape, size, and color if you want to highlight each exact data point.

Playing around with these options will quickly elevate your simple graph into a more powerful and polished visual communication tool.

Final Thoughts

Creating graphs of functions in Excel is all about turning an equation into a list of x-y coordinates and then using a Scatter chart to visualize them. Once you’re comfortable with referencing cells in your formulas and using the fill handle, you can plot everything from simple lines to complex curves right inside a spreadsheet.

As powerful as this method is, you can see how manually setting up spreadsheets and building reports becomes time-consuming when you're dealing with constantly updating data from business tools like Google Analytics, Shopify, or Salesforce. At Graphed , we automate all of that data wrangling. You can connect your marketing and sales platforms in just a few clicks, and then simply ask in plain English for the dashboard you need. Instead of setting up formulas manually, you just chat with your data to get answers, visualizations, and live reports instantly, giving you back time to act on insights instead of just gathering them.

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.