Skip to footer content
EXCEL TOOLS

How to Add Trendline in Excel: Every Method Explained (2026 Guide)

Adding a trendline in Microsoft Excel takes about three clicks. Select your chart, click the green + (Chart Elements) button that appears at the top right corner of the chart, and tick the Trendline checkbox. Excel instantly draws a linear trendline through your data series, and the overall direction hiding inside your numbers becomes visible at a glance. A trendline (sometimes written as trend line) turns a cluttered graph into a clear story about where the numbers are heading.

That is the fastest route, and for most Excel users it is all that is needed, whether you want a quick visual check or more advanced control over analysis and reporting. Trendlines work on most Excel charts, including line charts, column charts, bar charts, scatter plots, bubble charts, and area charts, and they are one of the simplest ways to reveal data trends in sales figures, website traffic, budget forecasts, or any other data that changes over time. If the chart itself still needs to be built, Microsoft's guide on creating a chart from start to finish covers that first step, and this walkthrough on how to make a scatter plot in Excel is worth a look, since scatter charts are the chart type where trendlines shine brightest.

The quick method above applies a default linear trendline, but Excel offers far more control than that. The sections below walk through three ways to add a trendline, how to choose among the six types (linear, exponential, logarithmic, polynomial, power, and moving average), how to add multiple trendlines, extend a line into future periods to forecast values, and display the trendline equation and R-squared value directly on the chart. Anyone building forecasts on top of trendlines may also want to read up on Excel's FORECAST.LINEAR function, which produces the same math in worksheet-formula form. You will also see what to do when the option is greyed out, plus how developers can automate the whole process with IronXL or VBA when trendline-ready reports need to be generated in bulk.

Method 1: The Chart Elements Button (Fastest)

  1. Click anywhere on your chart to select it.
  2. Click the + button (Chart Elements) that appears at the top right of the chart.
  3. Check the Trendline box.

Excel adds a linear trendline to the first data series. To choose a different type right away, select Trendline in the Chart Elements menu, click the small arrow that appears next to it, and pick Linear, Exponential, Linear Forecast, or Moving Average from the flyout menu. Selecting More Options opens the full Format Trendline pane. Once the trendline is successfully added, double-clicking it at any time reopens that pane for further tweaks.

Chart selected with the Chart Elements (+) flyout open and the Trendline checkbox highlighted

Method 2: The Ribbon (Chart Design Tab)

The ribbon route reaches the same destination and suits anyone who prefers menus over floating buttons:

  1. Select the chart.
  2. Go to the Chart Design tab on the ribbon (this tab only appears while a chart is selected; in older versions of Excel it is called Design under Chart Tools).
  3. In the Chart Layouts group, click Add Chart Element (the button on the far left).
  4. Hover over Trendline and choose a type: Linear, Exponential, Linear Forecast, or Moving Average.

Choosing More Trendline Options at the bottom of that menu opens the Format Trendline pane, where all six trendline types and every customization setting live.

Chart Design tab with the Add Chart Element dropdown expanded and Trendline submenu visible

Method 3: Right-Click the Data Series

Often the quickest method once it becomes a habit, because a right-click skips the ribbon entirely:

  1. Right-click directly on the data series in the chart (the line, the bars, or the dots themselves, not the empty chart area).
  2. Choose Add Trendline from the context menu.
  3. The Format Trendline pane opens immediately on the right side of the screen, ready for customization.

This method has one advantage over the others: in multi-series charts, right-clicking a specific series adds the trendline to exactly that series, with no extra dialog asking which one was meant.

Right-click context menu on a column series with Add Trendline highlighted

Choosing the Right Trendline Type

The Format Trendline pane offers various trendline types, and the choice matters because the wrong type can make data look more (or less) predictable than it really is:

Trendline type Best for
Linear Data increasing or decreasing at a steady rate. The default and the right choice most of the time.
Exponential Values that rise or fall at increasingly faster rates, such as compound growth. Unavailable if the data contains zero or negative values.
Logarithmic Data that changes quickly at first and then levels out.
Polynomial Data that fluctuates, with hills and valleys. The Order setting controls how many bends the curve can have (order 2 = one hill or valley).
Power Measurements that increase at a specific rate, like acceleration data. Also requires all-positive values.
Moving Average Smoothing out short-term fluctuation to reveal the underlying pattern. The Period setting controls how many data points are averaged.

Linear trendlines work best when data increases or decreases at a steady rate: the result is a straight line showing the overall direction of the numbers. The other five produce curved lines that follow more complex patterns. An exponential trendline fits compound growth, a logarithmic trendline suits data that levels out, a polynomial trendline handles data sets with hills and valleys, and power trendlines describe measurements changing at a specific rate. A moving average trendline stands apart from the rest: instead of fitting an equation, it smooths the series by averaging multiple data points across a chosen time period, which makes the underlying trend easier to see in noisy data. These differences matter because curved trendlines can exaggerate a pattern that a plain linear fit would present more honestly.

A useful sanity check: turn on the option to display R squared value on the chart (the checkbox at the bottom of the same pane). The closer R² is to 1, the better the trendline fits the data. When in doubt, choose Linear first, then compare R² across two or three trendline types to see which model actually describes the numbers.

How to Add Multiple Trendlines to the Same Chart

Excel places no one-trendline-per-chart limit, and there are two ways to end up with more than one trendline:

  1. One trendline per data series. In a chart with several series, repeat any of the methods above for each one. Comparing two data sets this way, each with its own fit, makes the gap between them obvious.
  2. Multiple trendlines on a single series. Right-click the same series and add a trendline again with a different trendline type. A linear and a moving average trendline on the same series, for example, show the long-term direction and the short-term smoothing at once.

To add trendlines to several series quickly, use the right-click method on each series in turn, then give each line its own color under Fill & Line in the Format Trendline pane so viewers can tell them apart. To add multiple trendlines without cluttering the chart, keep it to two per series at most.

Extending a Trendline into the Future (Forecasting)

Forecasting is one of the most searched trendline features, and it lives in the same Format Trendline pane:

  1. Double-click the trendline (or right-click it and choose Format Trendline).
  2. Scroll to the Forecast section.
  3. Enter several periods in the Forward box (for example, 6 to project six months ahead on monthly data).

Excel extends the trendline past the last real data point using the same equation, estimating future values based on the pattern so far. The Backward box does the reverse, extending the line before the first data point. Forecasts are only as good as the trendline fit, so check the R² value before presenting a projection to anyone important.

Displaying the Trendline Equation

To show the math behind the line, tick Display Equation on chart in the Format Trendline pane. For a linear trendline, the equation appears in the form y = mx + b, which can then be used in worksheet formulas to calculate predicted values for any x. If more decimal places are needed for precise calculations, right-click the equation label, choose Format Trendline Label, and set the Number category to Number.

Adding Trendlines with VBA (For Automation)

Anyone repeating the same charting task across dozens of workbooks can automate it with a short macro. Press Alt + F11 to open the VBA editor, insert a module, and paste:

Sub AddTrendline()
    Dim cht As Chart
    Set cht = ActiveSheet.ChartObjects(1).Chart
    cht.SeriesCollection(1).Trendlines.Add _
        Type:=xlLinear, _
        Forward:=6, _
        DisplayEquation:=True, _
        DisplayRSquared:=True
End Sub

This adds a linear trendline to the first series of the first chart on the active sheet, forecasts six periods forward, and displays both the equation and R² value. Changing Type:=xlLinear to xlExponential, xlLogarithmic, xlPolynomial, xlPower, or xlMovingAvg switches the trendline type.

Common Issues and Troubleshooting

The Trendline option is greyed out. Only certain chart types support trendlines: 2-D unstacked area, bar, column, line, stock, scatter, and bubble charts. Stacked charts, 3-D charts, pie charts, doughnut charts, radar charts, and surface charts do not. Convert the chart to a standard 2-D clustered or line chart (right-click the chart, Change Chart Type), and the option comes back.

No trendline option in Excel Online. Chart editing in Excel for the web is more limited than in the desktop app. If the option is missing in the browser, open the workbook in the desktop version of Microsoft Excel, add the trendline there, and it displays normally when the file is viewed in Excel Online again.

Exponential or Power is missing from the options: These two types require every value in the series to be positive and non-zero. A single zero or negative number removes them from the list.

The forecast looks wrong: The Forward setting counts periods, meaning data points, rather than calendar units. Also verify the chart type: a line chart treats the x-axis as categories, while a scatter (XY) chart treats x-values as real numbers, so a scatter chart is the more accurate choice for numeric forecasting.

The trendline disappeared after changing chart type - Switching to an unsupported type (such as stacked) silently removes trendlines. Switching back does not restore them, so they need to be re-added.

Automating Trendline-Ready Reports with IronXL

Everything above works well for one workbook at a time. When a report with trend analysis must be generated every week, for every region, from fresh data, that becomes a job for code, and it is exactly what IronXL is built for: a C# library that creates and edits Excel files without Excel installed on the machine. A common pattern is to let code compute the trend with Excel's own SLOPE and INTERCEPT functions, so the workbook arrives with trend values already calculated:

using IronXL;

WorkBook workBook = WorkBook.Create(ExcelFileFormat.XLSX);
WorkSheet sheet = workBook.DefaultWorkSheet;

// Write monthly sales data
sheet["A1"].Value = "Month";
sheet["B1"].Value = "Sales";
double[] sales = { 1200, 1350, 1280, 1500, 1620, 1580 };
for (int i = 0; i < sales.Length; i++)
{
    sheet[$"A{i + 2}"].Value = i + 1;
    sheet[$"B{i + 2}"].Value = sales[i];
}

// Calculate the linear trend with Excel formulas
sheet["D1"].Value = "Slope";
sheet["E1"].Formula = "=SLOPE(B2:B7,A2:A7)";
sheet["D2"].Value = "Intercept";
sheet["E2"].Formula = "=INTERCEPT(B2:B7,A2:A7)";
sheet["D3"].Value = "Next Month Forecast";
sheet["E3"].Formula = "=E2+E1*7";

workBook.SaveAs("sales-trend.xlsx");
using IronXL;

WorkBook workBook = WorkBook.Create(ExcelFileFormat.XLSX);
WorkSheet sheet = workBook.DefaultWorkSheet;

// Write monthly sales data
sheet["A1"].Value = "Month";
sheet["B1"].Value = "Sales";
double[] sales = { 1200, 1350, 1280, 1500, 1620, 1580 };
for (int i = 0; i < sales.Length; i++)
{
    sheet[$"A{i + 2}"].Value = i + 1;
    sheet[$"B{i + 2}"].Value = sales[i];
}

// Calculate the linear trend with Excel formulas
sheet["D1"].Value = "Slope";
sheet["E1"].Formula = "=SLOPE(B2:B7,A2:A7)";
sheet["D2"].Value = "Intercept";
sheet["E2"].Formula = "=INTERCEPT(B2:B7,A2:A7)";
sheet["D3"].Value = "Next Month Forecast";
sheet["E3"].Formula = "=E2+E1*7";

workBook.SaveAs("sales-trend.xlsx");
Imports IronXL

Dim workBook As WorkBook = WorkBook.Create(ExcelFileFormat.XLSX)
Dim sheet As WorkSheet = workBook.DefaultWorkSheet

' Write monthly sales data
sheet("A1").Value = "Month"
sheet("B1").Value = "Sales"
Dim sales As Double() = {1200, 1350, 1280, 1500, 1620, 1580}
For i As Integer = 0 To sales.Length - 1
    sheet($"A{i + 2}").Value = i + 1
    sheet($"B{i + 2}").Value = sales(i)
Next

' Calculate the linear trend with Excel formulas
sheet("D1").Value = "Slope"
sheet("E1").Formula = "=SLOPE(B2:B7,A2:A7)"
sheet("D2").Value = "Intercept"
sheet("E2").Formula = "=INTERCEPT(B2:B7,A2:A7)"
sheet("D3").Value = "Next Month Forecast"
sheet("E3").Formula = "=E2+E1*7"

workBook.SaveAs("sales-trend.xlsx")
$vbLabelText   $csharpLabel

The generated workbook opens in Excel with the trend already computed, and recipients can add the visual trendline to any chart with the three clicks from the top of this article. For teams producing recurring Excel deliverables, this removes the manual copy, paste, and format cycle entirely. A free trial of IronXL is available to test it against a real reporting workflow.

Conclusion

The fastest way to add a trendline in Excel is the Chart Elements + button, with the ribbon's Add Chart Element menu and the right-click context menu as equally capable alternatives. The real value comes from the Format Trendline pane: matching the trendline type to the shape of the data, checking the R² value, extending forecasts forward, and displaying the equation for use in calculations. When trendlines refuse to appear, the cause is almost always an unsupported chart type or non-positive values blocking the exponential and power options.

For readers moving from manual charts to automated reporting, the IronXL tutorials show how to read, edit, and generate Excel workbooks in C# for anyone ready to put the whole workflow on autopilot.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...

Read More

Iron Support Team

We're online 24 hours, 5 days a week.
Chat
Email
Call Me