An Excel linear trendline draws a best-fit straight line on a chart; FORECAST.LINEAR calculates a predicted value in a worksheet cell. Both use linear regression, but the trendline is mainly for visual analysis, while the function is useful when you need forecast values in formulas, tables, or reports.
What “linear trendline” and “linear forecast” mean
A linear trendline is a chart element that summarizes the relationship between numeric x-values and y-values with a straight line. Excel chooses the line that minimizes the sum of the squared vertical differences between the observed data points and the line. You can show its equation and R-squared value on the chart.
A linear forecast is a calculation based on the same kind of fitted line. In Excel, the usual worksheet function is FORECAST.LINEAR. It takes a target x-value and known x- and y-values, then returns the y-value on the fitted line at that x.
So “trendline versus forecast” is not a choice between two unrelated statistical methods. The key difference is how you use the result: one adds a line to a chart; the other returns a number you can reuse in the workbook. A chart trendline can also be extended forward, but that extension remains a chart display rather than a cell formula.
How Excel calculates a linear result
In a simple linear model, the fitted relationship is written as y = mx + b. Here, m is the slope, or expected change in y for a one-unit increase in x, and b is the intercept, the fitted y-value when x equals zero. The intercept may be mathematically useful even when x = 0 has no practical meaning in your data.
Excel estimates m and b from the known observations using least squares. The resulting line does not usually pass through every point. Instead, it balances the overall vertical errors, so points above and below the line contribute to the fit. A forecast at a new x-value is simply the line’s predicted y-value there.
For example, imagine a small dataset where x represents the month number and y represents units sold: month 1 has 10 units, month 2 has 12, and month 3 has 14. These points lie exactly on y = 2x + 8. The fitted slope is 2 units per month, so the line gives 16 units for month 4. Real business or scientific data are usually noisier, and the fitted line will not match every observation exactly.
Calculate a value with FORECAST.LINEAR
Use FORECAST.LINEAR(x, known_y's, known_x's) when you want a predicted result in a cell. The first argument is the x-value for which you want a prediction. The second range contains the observed outcomes, and the third contains the corresponding input values. The two known ranges must contain the same number of paired observations.
With month numbers in A2:A4 (1, 2, 3), sales in B2:B4 (10, 12, 14), and the target month 4 in D2, enter this in E2:
=FORECAST.LINEAR(D2,B2:B4,A2:A4)
The result is 16. Excel fits the line through the three pairs and evaluates it at the x-value in D2. If you change D2 to 5, the result is 18. The formula updates when the input cell or source values change, which makes it convenient for a forecast table. Keep each x-value aligned with its matching y-value; sorting one range without the other can produce a plausible-looking but incorrect answer.
Add and format a chart trendline
A trendline is useful when the reader needs to see the overall direction alongside the actual observations. For a reliable numeric relationship, first create an XY (Scatter) chart, particularly when the x-values are numbers or dates separated by unequal intervals.
- Arrange the x-values and y-values in paired columns, with a header for each.
- Select the data and choose Insert > Insert Scatter (X, Y) or Bubble Chart, then choose a scatter style.
- Select the chart, then choose Chart Design > Add Chart Element > Trendline > Linear.
- To show the equation or R-squared value, open the trendline formatting options and select the relevant display checkbox.
In Microsoft 365 for Windows, you can also select the chart, choose Chart Design > Add Chart Element > Trendline > More Trendline Options, and set the trendline options in the Format Trendline pane. The pane includes forward and backward forecast settings, which extend the displayed line by a specified number of x-axis units. Those settings do not add forecast results to worksheet cells.
Excel for Mac has chart trendlines and similar formatting controls, although the arrangement of chart tabs and panes can differ by release. Excel for the web supports common chart editing, but some detailed chart formatting controls may be limited compared with the desktop app. If an option is missing, open the workbook in the desktop version.
Choose the right tool for the job
Choose a chart trendline when your main goal is interpretation or presentation: showing whether values generally rise, fall, or remain steady. It is also a quick way to inspect whether a straight-line relationship is a reasonable first approximation. A chart can display the actual data and fitted line together, making deviations visible.
Choose FORECAST.LINEAR when you need values you can place in a table, reference in other formulas, or use in a recurring report. It is especially practical when you want forecasts for several future x-values: put those x-values in a column and copy the formula down, adjusting or locking the ranges as appropriate.
- Use a trendline to communicate a fitted relationship visually or inspect how the line sits relative to observations.
- Use FORECAST.LINEAR to calculate a specific predicted y-value in a worksheet cell.
- Use both when you want a chart for explanation and a formula-driven forecast table for downstream calculations.
Neither method is automatically a complete forecasting model. A straight line assumes a constant change in y for each equal increase in x. If the data show seasonality, a curve, a sudden change in process, or strong effects from other variables, a simple linear fit may mislead.
Chart settings and data details that matter
For numeric x-values, an XY (Scatter) chart is generally the clearest choice because the horizontal axis represents numeric spacing. A Line chart usually treats its horizontal axis as categories. The labels may look like dates or numbers, but the plotted positions can be evenly spaced by category rather than by the actual elapsed time. That distinction matters if observations are irregular—for example, measurements taken after 1, 2, and 10 days.
Check that the x-values are genuine numbers or dates recognized by Excel, not text that merely looks numeric. Also check for blanks, errors, duplicated values, and mismatched range lengths. If x-values are dates, Excel can use their underlying serial values, so a forecast is based on elapsed time rather than a month name as text. For monthly data with missing months, use actual date values or a deliberate numeric time index instead of assuming every row represents an equal interval.
A displayed trendline equation may be rounded for readability. If you copy its visible coefficients into another calculation, the rounded values can give a slightly different result from FORECAST.LINEAR, which calculates from the underlying data. Increase the equation label’s displayed decimal places if you need to inspect the coefficients, but use a worksheet function when the cell result needs to be calculated from the full-precision data.
Read R-squared and avoid overconfidence
R-squared describes how much of the observed variation in the y-values is accounted for by the fitted line, under the model’s assumptions. A value closer to 1 indicates that the points sit more closely around the fitted line in the sample. It does not prove that x causes y, establish that the relationship will continue, or guarantee accurate future predictions.
Look at the plotted points as well as the statistic. A high R-squared can hide a curved pattern or an influential outlier, while a low value may reflect natural variation rather than a data-entry mistake. A chart is useful here because it can reveal clusters, bends, and unusual observations that a single fit statistic cannot explain.
Most importantly, be cautious about extrapolation: predicting outside the range of observed x-values. The month 4 example is only one step beyond the data, and its answer is still an assumption that the recent linear pattern continues. Predicting many months ahead makes that assumption more consequential. A trendline’s forward extension and a formula’s forecast are both subject to this limitation.
Common problems and better alternatives
If the chart’s line and a cell forecast seem different, first confirm that they use the same data pairs and x-values. Then check whether the chart is a Line chart with category spacing, whether the trendline equation is rounded, and whether the forecast formula’s ranges are in the correct argument order. A chart can also be configured with a different trendline type, so confirm that its type is Linear.
Consider alternatives when the straight-line assumption is not appropriate. Excel’s FORECAST.ETS function is designed for a time series with a timeline and can model seasonality; it is not interchangeable with a simple linear fit. The TREND function can return fitted or predicted values for one or more new x-values using linear regression. For a relationship involving several explanatory variables, Excel’s Regression tool in the Analysis ToolPak may be more suitable than a one-variable chart trendline. These methods still require sensible data and model checking; a more complex function does not guarantee a better forecast.
Frequently Asked Questions
Is a trendline the same as FORECAST.LINEAR?
They use the same basic linear-regression idea when applied to the same paired data, but they are different Excel features. A trendline is a chart element; FORECAST.LINEAR returns a predicted number in a worksheet cell. Display rounding and chart-axis choices can make their visible results appear different.
Can an Excel trendline forecast future values?
Yes. In the Format Trendline pane, set a forward forecast period to extend the line visually. If you need future values in cells, use FORECAST.LINEAR with the future x-values instead. Both approaches assume the fitted linear pattern continues.
Why does my forecast not match the equation shown on the chart?
The chart equation is often rounded, and that rounding can change a calculation. Also verify that the formula and chart use the same observations and numeric x-values. For dates or irregular intervals, make sure the chart uses an XY (Scatter) axis rather than equally spaced categories.
Does FORECAST.LINEAR work with dates?
It can, provided Excel recognizes the dates as date values and the known and target dates are used consistently as x-values. Excel stores dates as serial numbers, so the calculation uses the numeric distance between dates. Text labels such as Jan or Feb are not a substitute for usable numeric date values.
Should I use FORECAST.LINEAR or FORECAST.ETS?
Use FORECAST.LINEAR when a straight-line relationship is a reasonable model. Consider FORECAST.ETS for time-series data where seasonal patterns may matter. Compare the model’s assumptions with the data and inspect the chart; neither function can determine whether its assumptions make sense for your situation.
Related
- Excel Not Responding and Won’t Close? Try These Fixes
- Excel Named Ranges List: Find, View, and Manage Defined Names
- Excel Named Range Shortcut: Create, Edit, and Use Names
Try it: the Percentage Formula Generator: percent of, percent change, increase and decrease, with the formula.
More in Charts & pivot tables
- Online Pivot Table Chart: How to Create, Read, and UseAn online pivot table chart is a visual summary built from data organized in a pivot table. In…
- Excel Gantt Chart Template Weekly: Build a TimelineYes—a weekly Gantt chart template in Excel can show each task as a bar across a calendar, with…
- Multi-Series Pivot Chart in Excel: Setup and TipsA multi-series PivotChart displays two or more related data series in one chart, usually by placing a category…
- Google Sheets Scatter Chart: Fix Common ProblemsTo fix a Google Sheets scatter chart, put numeric X values in one column and numeric Y values…
- Excel Sparklines Line Chart: How to Add and Format OneIn Excel for Microsoft 365 on Windows, select the data, choose Insert > Sparklines > Line, and specify…
- Excel Pivot Chart Date Format: Fix the Axis LabelsTo change date labels on an Excel PivotChart, select the chart’s date axis, right-click it, choose Format Axis,…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.