Excel Trendline Types: Equations & Formulas
In this article
Excel trendline types and their equations determine how a line of best fit is calculated and displayed on a chart. You can add six different trendlines—exponential, linear, logarithmic, polynomial, power, and moving average—each with its own formula and use case. This article explains each type, its equation, how to choose the right one, and common pitfalls.
in x | X value | - | 5 | 0 in y | Y value | - | 20 | 0 out slope | Slope (m) | - | (y - 0) / (x - 0) | 2 out intercept | Intercept (b) | - | y - ((y - 0) / (x - 0)) * x | 2
What Are Trendlines in Excel?
A trendline is a line superimposed on a chart that shows the general direction or pattern of the data. Excel fits the trendline using a mathematical formula, typically by minimizing the sum of the squares of the vertical distances between the data points and the line (the least squares method). The trendline equation is displayed on the chart, allowing you to predict values beyond the data range.
The Six Trendline Types and Their Equations
- Linear: y = mx + b. Best for data that follows a straight-line relationship. m is the slope, b is the y-intercept.
- Exponential: y = c * e^(b*x). Use when data increases or decreases at a constant percentage rate. c is the initial value, b is the growth/decay rate.
- Logarithmic: y = c * ln(x) + b. Fits data that increases or decreases quickly and then levels off.
- Polynomial: y = b + c1*x + c2*x^2 + ... + c6*x^6. Use for data with multiple bends. The order (degree) can be set from 2 to 6.
- Power: y = c * x^b. For data that follows a power-law relationship, e.g., growth proportional to a power of x.
- Moving Average: No equation; it smooths out fluctuations by averaging a specified number of preceding points.
How to Add a Trendline and Display Its Equation
- Click on the data series in your chart to select it.
- Right-click and choose Add Trendline.
- In the Format Trendline pane, select the type that best fits your data.
- Check the boxes for Display Equation on chart and Display R-squared value on chart.
- Adjust the polynomial order or moving average period if needed.
Choosing the Right Trendline Type
Selecting the correct trendline depends on the pattern of your data:
- Use linear when the data points roughly fall on a straight line.
- Use exponential when the data grows or decays at an increasing rate (e.g., population growth).
- Use logarithmic when the data rises quickly then plateaus (e.g., learning curves).
- Use polynomial when the data has one or more curves; start with order 2 and increase if needed.
- Use power when the data follows a multiplicative relationship (e.g., area vs. side length).
- Use moving average to reduce noise and highlight a trend over time.
Check the R-squared value (R²) to see how well the trendline fits. R² ranges from 0 to 1; the closer to 1, the better the fit. However, a high R² does not mean the model is appropriate—always visually inspect the line.
Common Mistakes and How to Avoid Them
- Using the wrong trendline type: For example, forcing a linear line on exponential data gives poor predictions.
- Ignoring units: If x is in years and y in dollars, the slope is dollars per year. Always keep track of units when interpreting the equation.
- Overfitting with high-order polynomials: A 6th-order polynomial may fit every point but will not generalize well.
- Forgetting to set the intercept: In the trendline options, you can set the intercept to a specific value (e.g., 0) if theory demands it.
- Not checking the R² value: A low R² (below 0.5) indicates a poor fit; consider a different type.
Limitations and Considerations
Trendlines are only as good as the data and the chosen model. They assume that the underlying pattern will continue, which may not hold for extrapolation far beyond the data range. Also, trendlines are sensitive to outliers; a single extreme point can skew the line. Always examine a plot of the residuals (the differences between actual and predicted values) if you need a rigorous analysis.
Frequently Asked Questions
What is the difference between linear and polynomial trendlines? A linear trendline is a polynomial of order 1. Polynomial trendlines can have multiple bends (curves) depending on the order; order 2 has one bend, order 3 has two, etc.
Why does my trendline equation have many decimal places? Excel shows the coefficients with a limited number of digits by default. To get more precision, select the equation text box, then increase the number of decimal places using the Home tab's number format options.
Can I use a trendline for any type of chart? Trendlines can be added to most 2D charts, including line, column, bar, and scatter charts. They cannot be added to stacked charts, pie charts, or 3D charts.
How do I get the trendline equation in a cell? You can use the LINEST function for linear regression, or LOGEST for exponential. For other types, you may need to use the chart's equation and manually enter the coefficients, or use the Analysis ToolPak's Regression tool.
What does the R-squared value mean? R² is the coefficient of determination. It indicates the proportion of the variance in the dependent variable that is predictable from the independent variable. A value of 0.9 means 90% of the variance is explained by the model.
Why does my moving average trendline have no equation? A moving average is not a mathematical function but a smoothed series of averages. Therefore, it does not have a simple equation to display. It is used for visualization, not prediction.