'Keep track of the style of the trendline. If trendline.Type = xlLogarithmic And xValue <= 0 Then 'If equation is logarithmic and x <= 0, return 0 'If the trendline is a moving average, return 0 Public Function calcTrendlineValueForX(trendline As trendline, xValue As Double) As Double Result = calcTrendlineValueForX((1).Trendlines(1), x) 'I have a sheet with one scatter plot in sheet 'graph'
You may want to set the precision of the Datalabel to suit your needs. I found a solution that works for every type of trendlines (exept for moving average of course).