Adding a trendline equation shows the mathematical relationship in your data

When you create a graph in Excel, you can display the equation that describes the pattern in your data. This equation appears as text on the graph itself and shows the formula Excel calculated to fit your data points. The equation is most useful when you have a scatter plot or line chart where you want to see the mathematical relationship — for example, how sales grow over time or how temperature affects energy use.

The equation appears in the form y = mx + b (for a straight line) or other formats depending on the type of pattern. You add it by inserting a trendline, which is a line that represents the trend in your data, and then telling Excel to display the equation alongside it.

Key Takeaways

  • Right-click the data series on your graph, select "Add Trendline", and choose the type that matches your data pattern.
  • Check the box labeled "Display Equation on chart" to make the formula visible on your graph.
  • Linear trendlines show straight-line relationships; polynomial and exponential options fit curved patterns.
  • The equation updates automatically if you change the underlying data, so you can see how the relationship shifts.

Steps to add a trendline equation in Excel

Start by creating your graph in Excel with your data already plotted. Click on the graph to select it, then right-click directly on one of the data points (the dots or markers on the line). A menu will appear with several options.

Select "Add Trendline" from the menu. A panel will open on the right side of your screen showing trendline options. The default is "Linear", which draws a straight line through your data. If your data follows a curve instead of a straight line, you can choose "Exponential", "Polynomial", "Power", or "Moving Average" — but start with Linear unless you know your data follows a different pattern.

In the trendline panel, scroll down until you see the checkbox labeled "Display Equation on chart". Click this box to turn it on. The equation will when ready appear on your graph, usually near the top or in an empty corner. You can click and drag the equation text to move it if it overlaps with your data.

Understanding what the equation tells you

A linear equation in the form y = 2.5x + 10 means that for every one-unit increase in x (your horizontal axis), y (your vertical axis) increases by 2.5 units, and the line crosses the y-axis at 10. The number in front of x is called the slope, and the number at the end is the y-intercept.

If you see an equation like y = 0.5x² + 3x + 2, that is a polynomial equation, which means your data follows a curved pattern rather than a straight line. The more complex the equation, the more the pattern curves. You do not need to memorize what each form means — the equation is mainly useful for showing the trend visually and for making predictions using that trend.

Choosing the right trendline type

Linear trendlines work best when your data points roughly form a straight line, even if they scatter around it. This is the most common choice for business data like sales over time or costs versus quantity.

Polynomial trendlines fit curved patterns. A polynomial of order 2 (called quadratic) creates a gentle curve; higher orders create more complex curves. Use this when your data clearly bends rather than staying straight.

Exponential trendlines show data that grows or shrinks faster and faster, like population growth or radioactive decay. Power trendlines show relationships where one variable depends on another raised to a power. Unless you have a specific reason to choose one of these, start with Linear and only switch if the line does not fit your data well.

Moving and formatting the equation text

Once the equation appears on your graph, you can click on it to select it. A border with handles will appear around the text. Drag it to a new location if it covers important parts of your graph. You can also right-click on the equation text to format it — change the font size, color, or style.

If the equation is hard to read because it overlaps with data points, move it to a blank area of the graph. If you want to remove the equation later, click on it and press Delete.

What happens when your data changes

If you edit the numbers in your original data table, the graph updates automatically, and so does the trendline equation. The slope and intercept will recalculate to fit the new data. This is useful if you are tracking something over time and want to see how the trend changes as you add new measurements.

If you add new data points to your table, make sure they are included in the range your graph is using. Then the trendline and equation will adjust to include them.

When a trendline equation is not the right tool

A trendline equation shows the overall pattern in your data, but it does not predict individual values with certainty. If your data points scatter widely around the trendline, the equation describes the trend but individual measurements may be far from what the equation predicts.

If you need to forecast future values or make precise predictions, you may want to use Excel's FORECAST function instead, which is designed specifically for that purpose. A trendline equation is best used for understanding the direction and strength of a relationship, not for making exact predictions.

Frequently Asked Questions

Can I display the R-squared value on my graph along with the equation?

Yes. In the trendline panel, check the box labeled "Display R-squared value on chart". The R-squared number tells you how well the trendline fits your data — values closer to 1 mean the line fits better, and values closer to 0 mean the data scatters more widely around the line.

Why does my equation show very small or very large numbers?

This usually happens when your data values are very large or very small, or when the scales of your x and y axes are very different. The equation is still correct; it is just harder to read. You can right-click the equation, select "Format Trendline Label", and change the number format to show fewer decimal places.

What if I want to use the equation to calculate values outside my graph?

You can type the equation into an Excel cell using the numbers from the equation text. For example, if your equation is y = 2.5x + 10 and you want to find y when x = 20, type =2.5*20+10 into a cell. However, predictions far outside your original data range are usually less reliable.

Can I add equations to multiple data series on the same graph?

Yes. Right-click on each data series separately and add a trendline to each one. Each trendline can have its own equation displayed. This is useful when comparing trends across different groups or categories.