# Trendlines.Add (PowerPoint)

Creates a new trendline.

Syntax : *expression*.**Add** (Type, Order, Period, Forward, Backward, Intercept, DisplayEquation, DisplayRSquared, Name)

```
Dim trnln As Trendline
Set trnln = ActivePresentation.Slides(1).Shapes(1).Chart.FullSeriesCollection(1).Trendlines.Add()
```

## Arguments

The following arguments are optional

Type (XlTrendlineType) - One of the enumeration values that specifies the trendline type. The default is xlLinear.

Possible Values are

xlExponential |
Uses an equation to calculate the least squares fit through points (for example, y=ab^x) . |

xlLinear |
Uses the linear equation y = mx + b to calculate the least squares fit through points. |

xlLogarithmic |
Uses the equation y = c ln x + b to calculate the least squares fit through points. |

xlMovingAvg |
Uses a sequence of averages computed from parts of the data series. The number of points equals the total number of points in the series minus the number specified for the period. |

xlPolynomial |
Uses an equation to calculate the least squares fit through points (for example, y = ax^6 + bx^5 + cx^4 + dx^3 + ex^2 + fx + g). |

xlPower |
Uses an equation to calculate the least squares fit through points (for example, y = ax^b). |

Order (XlTrendlineType) - The trendline order. Required ifType is set to xlPolynomial. If specified, the value must be an integer from 2 through 6.

Possible Values are

xlExponential |
Uses an equation to calculate the least squares fit through points (for example, y=ab^x) . |

xlLinear |
Uses the linear equation y = mx + b to calculate the least squares fit through points. |

xlLogarithmic |
Uses the equation y = c ln x + b to calculate the least squares fit through points. |

xlMovingAvg |
Uses a sequence of averages computed from parts of the data series. The number of points equals the total number of points in the series minus the number specified for the period. |

xlPolynomial |
Uses an equation to calculate the least squares fit through points (for example, y = ax^6 + bx^5 + cx^4 + dx^3 + ex^2 + fx + g). |

xlPower |
Uses an equation to calculate the least squares fit through points (for example, y = ax^b). |

Period (XlTrendlineType) - The trendline period. Required ifType is set to xlMovingAvg. If specified, the value must be an integer greater than 1 and less than the number of data points in the series to which you are adding a trendline.

Possible Values are

xlExponential |
Uses an equation to calculate the least squares fit through points (for example, y=ab^x) . |

xlLinear |
Uses the linear equation y = mx + b to calculate the least squares fit through points. |

xlLogarithmic |
Uses the equation y = c ln x + b to calculate the least squares fit through points. |

xlMovingAvg |
Uses a sequence of averages computed from parts of the data series. The number of points equals the total number of points in the series minus the number specified for the period. |

xlPolynomial |
Uses an equation to calculate the least squares fit through points (for example, y = ax^6 + bx^5 + cx^4 + dx^3 + ex^2 + fx + g). |

xlPower |
Uses an equation to calculate the least squares fit through points (for example, y = ax^b). |

Forward (Long) - The number of periods (or units on a scatter chart) that the trendline extends forward.

Backward (Long) - The number of periods (or units on a scatter chart) that the trendline extends backward.

Intercept (Trendline) - The trendline intercept. If specified, the value must be a double-precision floating-point number. If omitted, the intercept is automatically set by the regression, and the InterceptIsAuto property of the resulting Trendline object is set to True.

DisplayEquation (Boolean) - True to display the equation of the trendline on the chart (in the same data label as the R-squared value).

DisplayRSquared (Boolean) - True to display the R-squared value of the trendline on the chart (in the same data label as the equation).

Name - String