TREND function

# TREND function

This article describes the formula syntax and usage of the TREND  function in Microsoft Excel.

## Description

Returns values along a linear trend. Fits a straight line (using the method of least squares) to the arrays known_y's and known_x's. Returns the y-values along that line for the array of new_x's that you specify.

## Syntax

TREND(known_y's, [known_x's], [new_x's], [const])

The TREND function syntax has the following arguments:

• Known_y's    Required. The set of y-values you already know in the relationship y = mx + b.

• If the array known_y's is in a single column, then each column of known_x's is interpreted as a separate variable.

• If the array known_y's is in a single row, then each row of known_x's is interpreted as a separate variable.

• Known_x's    Required. An optional set of x-values that you may already know in the relationship y = mx + b.

• The array known_x's can include one or more sets of variables. If only one variable is used, known_y's and known_x's can be ranges of any shape, as long as they have equal dimensions. If more than one variable is used, known_y's must be a vector (that is, a range with a height of one row or a width of one column).

• If known_x's is omitted, it is assumed to be the array {1,2,3,...} that is the same size as known_y's.

• New_x's    Required. New x-values for which you want TREND to return corresponding y-values.

• New_x's must include a column (or row) for each independent variable, just as known_x's does. So, if known_y's is in a single column, known_x's and new_x's must have the same number of columns. If known_y's is in a single row, known_x's and new_x's must have the same number of rows.

• If you omit new_x's, it is assumed to be the same as known_x's.

• If you omit both known_x's and new_x's, they are assumed to be the array {1,2,3,...} that is the same size as known_y's.

• Const    Optional. A logical value specifying whether to force the constant b to equal 0.

• If const is TRUE or omitted, b is calculated normally.

• If const is FALSE, b is set equal to 0 (zero), and the m-values are adjusted so that y = mx.

## Remarks

• For information about how Microsoft Excel fits a line to data, see LINEST.

• You can use TREND for polynomial curve fitting by regressing against the same variable raised to different powers. For example, suppose column A contains y-values and column B contains x-values. You can enter x^2 in column C, x^3 in column D, and so on, and then regress columns B through D against column A.

• Formulas that return arrays must be entered as array formulas.

Note:  In Excel Online you cannot create array formulas.

• When entering an array constant for an argument such as known_x's, use commas to separate values in the same row and semicolons to separate rows.

## Example

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.

 Month Cost Formula (Corresponding Cost) Live Result 1 \$133,890 =TREND(A2:A13,B2:B13) \$133,953 2 \$135,000 \$134,972 3 \$135,790 \$135,990 4 \$137,300 \$137,008 5 \$138,130 \$138,026 6 \$139,100 \$139,044 7 \$139,900 \$140,062 8 \$141,120 \$141,081 9 \$141,890 \$142,099 10 \$143,230 \$143,117 11 \$144,000 \$144,135 12 \$145,290 \$145,153 Month Formula (Predicted Cost) Live Result 13 =TREND(B2:B13,A2:A13,A15:A19) \$146,172 14 \$147,190 15 \$148,208 16 \$149,226 17 \$150,244 In the Live Result column, the ranges D2:D13 and D15:D19 each contain one formula that is used for all cells in the range. Enter the formula =TREND(A2:A13,B2:B13) in D2:D13 with all its cells selected and then press CTRL+SHIFT+Enter to enter it as an array formula.Do the same with the range D15:D19, using the formula =TREND(B2:B13,A2:A13,A15:A19). You can copy these formulas from cells C2 and A15.
Connect with an expert