How to Fit Curves in Excel: Trendlines and Forecast Functions

Use Excel functions to fit curves and forecast values. Explain the usage, selection criteria, and common pitfalls of SLOPE, TREND, GROWTH, LINEST, and other functions. This is intended for people who need to calculate fitting parameters and predicted values directly in cells.

Key points of this article

  • When data roughly follows a straight line, use SLOPE and INTERCEPT to get the slope and intercept, and use TREND or FORECAST to calculate predicted values.
  • Data that grows increasingly fast can be fitted with an exponential curve using GROWTH or LOGEST, but all y values must be greater than 0.
  • The result of a function fit is a number in a cell that other formulas can reference, which chart trendlines cannot do.
  • A high R² only indicates how closely the historical data fits; it does not guarantee that extrapolated predictions are reliable, so be especially cautious when predicting beyond the range of the data.
  • Before forecasting, delete incomplete rows to ensure that x and y are paired and have the same number of values; otherwise the functions may return errors or distorted results.

You have a column of months and sales figures and want to estimate next quarter's total, or you have a set of experimental data points and want a curve that fits them. Many people first think of the trendline in a chart. But a trendline only draws a line on the graph: the formula's parameters aren't available in any cell, and you can't use it to generate predicted values in bulk. To calculate fitting parameters directly in a worksheet and use the predictions in further calculations, you need to fit the data with Excel functions.

This article is for people who need to make data predictions and don't want to draw charts by hand every time. After reading it, you will know which function to use when the data is linear or curved, how to calculate the slope, intercept, and predicted values step by step in a spreadsheet, and where judgment mistakes are most likely to occur.

How do you do function fitting in Excel? One-sentence answer

When the data changes roughly along a straight line, use SLOPE and INTERCEPT to find the line's parameters, and use TREND or FORECAST to calculate predicted values; when the data follows a curve, use GROWTH, LOGEST, or LINEST to fit an exponential or polynomial instead.

Your situationRecommended PracticesCause
The data changes roughly in a straight line.TREND or FORECAST.LINEARReturn the predicted values directly; the formula can be filled down to reuse it.
I only want to know the slope and the interceptSLOPE, INTERCEPTObtain the two parameters of y=kx+b, so that they can be easily written into the report
Growth is getting faster and faster, approaching exponential.GROWTH or LOGESTFit using y = b·m^x, suitable for data whose growth rate is approximately constant
The data shows a clear curvature.LINEST combined with x^{1,2}Find the coefficients of a quadratic polynomial at once
The data is ordered by time and shows seasonal fluctuations.FORECAST.ETSIt takes seasonality into account, so it follows historical trends more closely than a simple linear model does.

What Exactly Is Function Fitting?

Fitting means finding a curve that stays as close as possible to all the data points. A common method is least squares: make the sum of the squared vertical distances from each data point to the curve as small as possible. Excel's SLOPE, INTERCEPT, LINEST and other functions all calculate based on this principle, so you don't need to derive the formulas yourself; you only need to give the correct data range and choose the right function.

The difference between function fitting and a chart trendline lies in where the results go. A trendline is an add-on element of a chart: its equation and R² are displayed only on the chart. The result of function fitting consists of numbers in cells, which can be referenced by other formulas and automatically recalculated when the data is updated.

How Functions Work

  • The arguments known_y and known_x are two sets of data; their lengths must be the same, and they correspond one-to-one.
  • TREND(known_y, known_x, new_x) fits a straight line based on the first two sets of data and returns the predicted values corresponding to new_x.
  • LINEST returns an array, and the order of the coefficients is the reverse of the order of the x columns. When using x^{1,2}, the results are, in order, the coefficient of x², the coefficient of x, and the constant term.

Common Misconceptions

  • A high R² does not guarantee reliable forecasts. RSQ only indicates how closely the historical data fits the fitted curve. With little data or a lot of noise, R² can still be high while future trends fail to continue.
  • Extrapolation risk. A fit is only reasonably reliable within the range of the data; when predictions go far beyond the historical range, the results can easily be distorted.
  • Exponential fitting has prerequisites. GROWTH and LOGEST require all y values to be greater than 0; zeros or negative values will cause errors, in which case a linear or other model should be used instead.
  • A higher R² is not always better for the model. When choosing a curve type, first examine the pattern of change in the data and its business meaning, then compare fit results, rather than focusing only on the numerical value.

📊 Core Comparison

MethodOutput the resultSuitable scenarios
Chart trendlineA line on the chart that can display the equation and R²Quickly observe trends, no need to perform calculations within the cells
SLOPE, INTERCEPTSlope and intercept: two parametersThe data show a linear relationship, so we need to write out the equation.
TREND, FORECASTPredicted value at the specified positionLinear extrapolation, batch-obtaining prediction results
GROWTH, LOGESTExponential parameters or predicted valuesGrowth-type data, and all y values are positive
LINESTPolynomial Coefficients and StatisticsQuadratic or Higher-Degree Curve Fitting

Practical Usage

Below, using a 12-month sales dataset as an example, we complete fitting and forecasting in Excel:

  1. Put the independent variable x in column A, such as month numbers 1 to 12; put the dependent variable y in column B, i.e., monthly sales.
  2. In blank cells, enter =SLOPE(B2:B13,A2:A13) and =INTERCEPT(B2:B13,A2:A13) to get the slope and intercept, respectively.
  3. To forecast sales for month 13, enter =TREND(B2:B13,A2:A13,13) and compare it with the actual values.
  4. If the data clearly curves, enter =LINEST(B2:B13,A2:A13^{1,2}) to obtain the quadratic fit coefficients, noting that the output order is the reverse of the x columns.
  5. Use =RSQ(B2:B13,A2:A13) to check how well the straight-line fit matches; plot the actual and predicted values together to check whether the trend is reasonable.
  6. If the original data is in a PDF report: for an electronic PDF, you can directly export it to Excel using a PDF editor; for a scanned PDF, you first need to use the OCR function of a desktop client to recognize the text, and then export it. Once you have the table, fit it using the steps above. You can first try selecting a passage of text in the PDF; if you cannot select it, it is usually a scanned document.

The exported and recognized figures may contain errors, so please check the key data item by item before calculating.

🎯 Which Approach Suits You?

  • Just want a quick overview of the trend: insert a trendline on the chart first, and check whether the movement looks close to a straight line or a curve.
  • Need to keep forecasts updated in the sheet: use TREND or FORECAST; when data is added, the formulas recalculate directly.
  • Need to explain the model to others: use SLOPE and INTERCEPT to write out the equation, and add RSQ to explain how well it fits.
  • Data shows clear curvature or exponential growth: first draw a scatter plot to confirm the shape, then choose GROWTH, LOGEST, or LINEST.

❓ Frequently Asked Questions (FAQ)

1. Are the results of a chart trendline and TREND the same?

When the data has a linear relationship, the parameters of the two are essentially the same. The difference is that a trendline is only displayed on the chart, whereas the results of TREND are in cells and can continue to be used in calculations.

2. What happens to a function when the data has blanks or text?

If the number of data points in x and y does not match, the function will usually raise an error. You should first remove the incomplete rows so that each x corresponds to one y, and then perform the fit.

3. GROWTH: Why is an error being reported?

GROWTH and LOGEST require all y values to be greater than 0. When the data contains zeros or negative numbers, the exponential model is not applicable, and you can use linear fitting or another model instead.

4. Do prediction results need to be verified?

Historical patterns cannot guarantee their continuation into the future, especially for predictions that go beyond the range of the data. It is recommended to validate with a portion of data that was not used in fitting, and important conclusions should be reviewed manually rather than taken directly as definitive.

📝 Summary

The core of fitting with Excel functions is: first look at the shape of the data, then choose the right function. For straight lines, use SLOPE, INTERCEPT, and TREND; for curves, use GROWTH, LOGEST, or LINEST, and check the results with RSQ and by comparing against actual values. Mastering this approach to Excel function fitting lets you complete the entire process, from fitting to forecasting, within a spreadsheet.

Open OmniDoc and process your spreadsheet files

Updated 2026-11-29