

The equation of the line would be y = mx + b and b = 0. For example, the y-intercept would be set equal to 0 when the x-variable is 0. How can I calculate the coefficient of determination for a linear regression with a defined y-intercept? The y-variable is the dependent variable and the x-variable is the independent variable. So I'll start by asking my question and then explain what has caused me to ask this question. Then, anytime TLEq is empty, line 4 errors because it cannot carry out the CDbl(Mid()) an empty TLEq.My question is multifaceted. The issue begins in line 2 where TLEq is inconsistently left blank during the loop some iterations all the trendline equation are extracted, sometimes only some are, and other times no equations are extracted. There has been no issues with graphing, trendlines showing up, or trendline equations displaying. In lines above these (not included), the series are added, trendlines inserted, and DisplayEquation is called for each trendline. The CDbl(Mid()) is used to trim TLEq to just the slope and convert to a Double. TLEq is a string to temporarily hold the full text of the trendline equation (intercept set to 0 so simple y = mx equation). SelectedSheets is an array filled with the sheets the user selects to be analyzed from a multi-select userform listbox.


ModulusArr(j) = CDbl(Mid(TLEq, 4, Len(TLEq) - 4)) I want to report the slope average of all the trendlines and I've written the code below to do this action: For j = 1 To UBound(SelectedSheets) I've had success with everything except extracting the trendline slopes. I'm currently making a macro to extract raw data from multiple csvs, print it in different sheets, trim extraneous data, plot data from each sheet on a single graph with individual trendlines, and report some information for said trendlines and data.
