# TREND

## Content

This function returns values along with a linear trend. This function fits a straight line to the arrays known as x and y values. Trend returns the y values along that line for the array of specified new x values.

## Syntax

`TREND(y, x, newx, constant)`

## Arguments

This function has these arguments:

| Argument | Description |
| -------- | ----------- |
| *y* | Set of y values that are known in the relationship y=mx+b |
| x | (Optional) X is an optional set of x values that may be known in the relationship y=mx+b |
| *newx* | New x values for which this function returns the corresponding y values |
| *constant* | Logical value that specifies whether to force the constant b to equal 0 |

## Remarks

If *constant* is true or omitted then b is calculated normally. If *constant* is false then b is equal to 0 and the m values are adjusted so that y=mx.

If *x* is omitted then *x* defaults to the array {1,2,3...}, that has the same dimensions as *y*.

If *newx* is omitted then it defaults to *x*.

Use the [INDEX](/spreadjs/docs/v17/formulareference/FormulaFunctions/lookup-reference-functions/FORMULA_INDEX) function to get individual elements from the returned array.

## Data Types

Accepts an array. Returns an array.

## Examples

`TREND(A2:A7,C2:C7,A9:A10)`