Add a trendline equation by right-clicking the data line
To show an equation on your Excel graph, you add a trendline — a line that represents the mathematical relationship between your data points. Excel calculates the equation automatically and displays it on the chart itself.
The fastest way is to right-click directly on the colored data line in your graph (not the background, not the axis — the line itself). A menu appears. Click Add Trendline. A panel opens on the right side of your screen.
In that panel, scroll down until you see Display Equation on chart. Check that box. The equation appears immediately on your graph. You can drag it to a clearer spot if it overlaps other elements.
Key Takeaways
- Right-click the colored data line in your chart, then select Add Trendline to open the trendline options panel.
- Check the box labeled Display Equation on chart to make the equation visible on your graph.
- Excel offers different trendline types (linear, exponential, polynomial) — linear is the default and works for most everyday charts.
- You can move the equation box by clicking and dragging it to a spot where it does not cover important data.
- The R-squared value (if you display it) tells you how well the equation fits your actual data — closer to 1.0 means a better fit.
Choose the right trendline type for your data
Excel offers several trendline shapes. Linear is selected by default and draws a straight line — use this for data that increases or decreases at a steady rate. If your data curves upward or downward, try Exponential or Polynomial instead.
To change the type, look at the trendline panel on the right. Under Trendline Options, you see radio buttons for different shapes. Click the one that matches your data pattern. The equation updates automatically when you switch types.
Most everyday charts use linear trendlines. If you are unsure which type fits best, start with linear. If the line does not follow your data points closely, try polynomial (usually set to degree 2, which creates a gentle curve).
Display the R-squared value to see how well the equation fits
The R-squared value (written as R²) tells you whether the equation actually describes your data well. It ranges from 0 to 1. A value close to 1 means the equation fits your data tightly; a value close to 0 means the equation does not match the pattern.
To show it, check the box labeled Display R-squared value on chart in the same trendline panel. The R² number appears near the equation on your graph. For example, R² = 0.92 means the equation explains 92 percent of the variation in your data.
You do not need to display R² if you are just showing the equation for reference. It is most useful when you are trying to decide whether a trendline is reliable enough to predict future values.
Move or format the equation box
Once the equation appears on your chart, you can click it to select it (a border appears around the text box). Drag it to any spot on the chart where it does not cover your data. You can also right-click the equation box itself to change the font size, color, or background.
If the equation is hard to read against your chart background, right-click it and choose Format Text Box. You can add a white background fill or change the text color to make it stand out.
Remove the trendline or equation
If you no longer want the trendline on your chart, right-click it (the line itself, not the equation) and select Delete. The line and equation both disappear.
If you want to keep the trendline but hide the equation, open the trendline panel again (right-click the line, select Format Trendline), and uncheck Display Equation on chart.
Common equation formats Excel uses
Excel writes equations in standard mathematical form. A linear equation looks like y = 2.5x + 10, where 2.5 is the slope (how steep the line is) and 10 is the y-intercept (where the line crosses the vertical axis). An exponential equation looks like y = 5e^0.3x, where e is a mathematical constant.
You do not need to understand the math to use the equation — it is there so you can see the relationship between your variables or predict future values by plugging in a new x value. If you want to use the equation in calculations elsewhere, you can type it into a cell manually or use Excel's built-in functions.
Frequently Asked Questions
Why does my equation show very small or very large numbers?
This usually happens when your data values are very large or very small. Excel calculates the equation correctly, but the display can look odd. You can reformat the equation box to show fewer decimal places, or you can scale your data differently if the numbers are hard to read.
Can I add an equation to a pie chart or bar chart?
No. Trendlines only work on scatter plots and line charts — charts where data points are plotted on an x and y axis. Pie and bar charts do not have a mathematical relationship between axes, so an equation does not apply.
What if I want to use the equation in a formula?
You can type the equation into a cell manually. For example, if your equation is y = 2.5x + 10 and you want to predict y when x is 20, type =2.5*20+10 into a cell. Excel calculates the result. For more complex equations, you may want to use Excel's FORECAST or TREND functions instead.
Can I add multiple equations to one chart?
Yes. If your chart has multiple data series (multiple colored lines), you can add a trendline and equation to each one separately. Right-click each data line and add its own trendline. Each equation displays independently on the chart.
Does the equation update if I change my data?
Yes. If you edit the numbers in your data table, the trendline recalculates automatically and the equation updates to match the new data pattern.