PDA

View Full Version : Using Trendline Formulae



PKG
09-19-2008, 07:57 AM
Hi,

I have a data series, displaying the values shown below:

WSp 4.18, 5.57, .8.36, 9.76, 11.16, 12.55, 13.95, 15.34, 16.74
SPL 17.95, 17.95, 17.95, 22.35, 24.95, 25.65, 25.65, 25.65, 25.65, 25.65

What I need to do is fit a second order polymial line to the series, so I can get an SPL value for integer WSp values (e.g. 4.0,5.0,6.0 etc).

I have created a simple x/y scatter chart and fitted a second order polynomial line to the series, and the formula gets displayed on the graph. What I can't seem to do is then use this formula to perform calculations in the sheet.

Any suggestions very welcome!

PKG

Northwolves
09-20-2008, 06:55 AM
Trend WorksheetFunction


(mk:@MSITStore:C:\Program%20Files\Microsoft%20Office\OFFICE11\1033\xlmain11 .chm::/html/xlfctTREND1.htm#)
TREND


See Also (javascript:hhobj_1.Click())
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)
Known_y's is 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 is 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 are 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 is 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.
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
The example may be easier to understand if you copy it to a blank worksheet.
http://vbaexpress.com/forum/mk:@msitstore:msohlp11.chm::/html/blueup.gifHow? (mk:@MSITStore:C:\Program%20Files\Microsoft%20Office\OFFICE11\1033\xlmain11 .chm::/html/xlfctTREND1.htm#)

Create a blank workbook or worksheet.
Select the example in the Help topic. Do not select the row or column headers. http://vbaexpress.com/forum/mk:@MSITStore:C:\Program%20Files\Microsoft%20Office\OFFICE11\1033\xlmain11. chm::/img/selecthelp.gif
Selecting an example from Help
Press CTRL+C.
In the worksheet, select cell A1, and press CTRL+V.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Tools menu, point to Formula Auditing, and then click Formula Auditing Mode.
The first formula shows corresponding values to the known values. The second formula predicts the next months values, if the linear trend continues.
12345678910111213ABCMonthCostFormula (Corresponding Cost)1$133,890=TREND(B2:B13,A2:A13)2$135,0003$135,7904$137,3005$138,1306$13 9,1007$139,9008$141,1209$141,89010$143,23011$144,00012$145,290MonthFormula (Predicted Cost)13=TREND(B2:B13,A2:A13,A15:A19)14151617
Note The formula in the example must be entered as an array formula. After copying the example to a blank worksheet, select the range C2:C13 or B15:B19 starting with the formula cell. Press F2, and then press CTRL+SHIFT+ENTER. If the formula is not entered as an array formula, the single results are 133953.3333 and 146171.5152.