Returning a data point off a Polynominal Trendline

Archer99

New Member
Joined
Oct 19, 2016
Messages
5
This is the first time I have posted here so you will have to bear with me for a moment. I work with shipping containers and I am interested in determining how many slots I can fill on board a vessel with a specific cargo mix. The catch is that while 20' units can fit anywhere, 40' units can only fit in specific areas on board. I have extracted some historical data that shows how many 20' units will normally fit in addition to a specific number of 40' units. So, with 40' units as my point of reference, the results come up as this:

20'
40'
3040
28820
26040
22660
16280

<tbody>
</tbody>

(ie. If I want to load 60 x 40' units then I can only load 226 x 20' as additional cargo around them)

After extracting the equation from the graph I get this:
y = -7.2857x2 + 9.1143x + 300.8

So my question is this - If I want to create an open cell where I can enter the number of 40's to be loaded (eg. 46), how can I input this equation into a formula to determine how may 20' slots will be available off the data provided above?

I have used FORECAST and TREND but these seem to only follow Linear equations. I am rather stumped so I would be grateful if anyone had any ideas to solve this one.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
After extracting the equation from the graph I get this:
y = -7.2857x2 + 9.1143x + 300.8

So my question is this - If I want to create an open cell where I can enter the number of 40's to be loaded (eg. 46), how can I input this equation into a formula to determine how may 20' slots will be available off the data provided above?

First, that trendline formula is incorrect. My guess is: you created a line chart, then displayed the formula for a 2-degree polynomial trendline. The problem is: in a line chart, the trendline formula always assumes that x is 1, 2, 3 etc, not the values that you might have assigned to the x-axis.

Instead, you should create an scatter chart. Then the formula for the 2-degree polynomial trendline appears to be about

-0.0182*x^2 - 0.2729*x + 302.63.

Second, when you copy the coefficients from the chart trendline formula ("label"), it is important to format the trendline label so that it displays sufficient precision. Generally, I suggest using the format Scientific with 14 decimal places. That works regardless of the magnitude of the coefficients, which can vary widely (albeit not so much in your case). Thus, the formula for the polynomial trendline appears to be:

-1.82142857142857E-02*x^2 - 2.72857142857134E-01*x + 3.02628571428571E+02

Finally, since you have only 5 pairs of data, you can use a 4-degree polynomial trendline to fit the data exactly.

That said, usually it is possible to use LINEST to generate the polynomial coefficients directly in the worksheet, without the need to copy them from the chart trendline label. For example:


A
B
C
D
E
F
1
x
yest y


2
0304304
a1-0.0000078125
3
20288288
a20.0010625000
4
40260260
a3-0.0568750000
5
60226226
a4-0.0250000000
6
80162162
a5304.0000000000
7
101
3.0161



<tbody>
</tbody>
Rich (BB code):
Formulas:
C2 :     =SERIESSUM(A2,4,-1,$F$2:$F$5) + $F$6
F2:F6 :  { =TRANSPOSE(LINEST(B2:B6, A2:A6^{1,2,3,4})) }

Formulas displayed with curly brackets {...} are array-entered, to wit: type the formulas without the curly brackets, then press ctrl+shift+Enter instead of just Enter. Excel displays the curly brackets in the Formula Bar to indicate that the formula is array-entered.

PS.... You might notice that I reversed the columns of data: 40' units (x) on the left; 20' units (y) on the right. That is more convenient for creating the scatter chart. But it is not necessary. Your original order work as well.


Copy C2 into C3:C7.

Thus, we can estimate the number of 20' units (est y) in column C by entering any number of 40' units (x) into the corresponding cell in column A

FYI, we cannot use SERIESSUM(...,F2:F6) because for x=0, which is part of the data, SERIESSUM would try to evaluate 0^0, wihch results in a #NUM error.

Also, LINEST returns a row of coefficients. I use TRANSPORT to return a column of coefficients. That's a personal choice. Alternatively, you can array-enter the LINEST formula into F2:J2, for example.

Generally, polynomial trendline (even the 2-degree polynomial) should be used only to interpolate data between the endpoints; in your case, between x=0 and x=80. Outside those limits, the polynomial trendline might have surprising behavior.

However, in your case, I was able to extend the 4-degree polynomial trendline by 40 units to x=100 with reasonable results, or so it appears. (Only you can determine what is and is not "reasonable".)

In fact, for x=101, est y=3 (about), as demonstrated in C7. For x=102 or more, est y becomes negative, which is not practical in your case.
 
Last edited:
Upvote 0
Hi joeu2004. Thanks for the in depth reply! Unfortunately a lot of the maths in this is well beyond my understanding so I could only follow it up to the table that you provided. I believe that I have inputted the formulas correctly in column C and F, however I am ending up with this:


-- removed inline image ---

-- removed inline image ---


I'm guessing that there is a step I'm missing here, and maths at this level was never my strong point. I would be grateful if you could please explain what I should be doing from here. :confused: Thank you!
 
Upvote 0
Okay, I guess this forum doesn't like screen shots. Try this! :)

XYEst. Y
0304-0.0000078125 -0.0000078125
20288-1.3157890625 -0.0000078125
40260-20.5128203125 -0.0000078125
60226-102.9661015625 -0.0000078125
80162-324.0506328125 -0.0000078125
101 -821.1016015625

<colgroup><col span="2"><col><col><col><col></colgroup><tbody>
</tbody>
 
Upvote 0
Formulas:
C2 : =SERIESSUM(A2,4,-1,$F$2:$F$5) + $F$6
F2:F6 : { =TRANSPOSE(LINEST(B2:B6, A2:A6^{1,2,3,4})) }
I'm guessing that there is a step I'm missing here
XYEst. Y
0304-0.0000078125-0.0000078125
20288-1.3157890625-0.0000078125
40260-20.5128203125-0.0000078125
60226-102.9661015625-0.0000078125
80162-324.0506328125-0.0000078125
101-821.1016015625

<tbody>
</tbody>

Yes: You omitted the TRANSPOSE function. See above.

If you prefer array-enter just =LINEST(...) without TRANSPOSE, select F2:J2 instead. Also, be sure to replace $F$2:$F$6 with $F$2:$J$2 in the SERIESSUM function.

This also gives me an opportunity to embellish my previous explanation. I labeled F2:F6 as "a1", "a2" etc. So the SERIESSUM function represents the math formula:

estY = a1*x^4 + a2*x^3 + a3*x^2 + a4*x + a5

Hope that helps. Feel free to ask any other questions.
 
Upvote 0
Yes: You omitted the TRANSPOSE function. See above.

If you prefer array-enter just =LINEST(...) without TRANSPOSE, select F2:J2 instead. Also, be sure to replace $F$2:$F$6 with $F$2:$J$2 in the SERIESSUM function.

This also gives me an opportunity to embellish my previous explanation. I labeled F2:F6 as "a1", "a2" etc. So the SERIESSUM function represents the math formula:

estY = a1*x^4 + a2*x^3 + a3*x^2 + a4*x + a5

Hope that helps. Feel free to ask any other questions.


I did include the TRANSPOSE function in the original post but there is definitely something being lost in translation. To simplify things (hopefully :) ) I am going to show what I have entered in the cells so far:

A
B
C
D
F
G
1
x
y
Formula Used in Colum C

<colgroup><col width="332"></colgroup><tbody>
</tbody>
Formula Used in Column F

<colgroup><col width="349"></colgroup><tbody>
</tbody>
2
0
304
-0.0000078125

<colgroup><col width="135"></colgroup><tbody>
</tbody>
<--- = SERIESSUM(A2,4,-1,$F$2:$F$5)+$F$6

<colgroup><col></colgroup><tbody>
</tbody>
-0.0000078125

<colgroup><col width="135"></colgroup><tbody>
</tbody>
<--- { =TRANSPOSE(LINEST(B2:B6,A2:A6^{1,2,3,4})) }

<colgroup><col></colgroup><tbody>
</tbody>
3
20
288
-1.3157890625

<colgroup><col width="135"></colgroup><tbody>
</tbody>
<--- = SERIESSUM(A3,4,-1,$F$2:$F$5)+$F$6

<colgroup><col></colgroup><tbody>
</tbody>
-0.0000078125

<colgroup><col width="135"></colgroup><tbody>
</tbody>
<--- { =TRANSPOSE(LINEST(B2:B6,A2:A6^{1,2,3,4})) }

<colgroup><col></colgroup><tbody>
</tbody>
4
40
260
-20.5128203125

<colgroup><col width="135"></colgroup><tbody>
</tbody>
<--- = SERIESSUM(A4,4,-1,$F$2:$F$5)+$F$6

<colgroup><col></colgroup><tbody>
</tbody>
-0.0000078125

<colgroup><col width="135"></colgroup><tbody>
</tbody>
<--- { =TRANSPOSE(LINEST(B2:B6,A2:A6^{1,2,3,4})) }

<colgroup><col></colgroup><tbody>
</tbody>
5
60
226
-102.9661015625

<colgroup><col width="135"></colgroup><tbody>
</tbody>
<--- = SERIESSUM(A5,4,-1,$F$2:$F$5)+$F$6

<colgroup><col></colgroup><tbody>
</tbody>
-0.0000078125

<colgroup><col width="135"></colgroup><tbody>
</tbody>
<--- { =TRANSPOSE(LINEST(B2:B6,A2:A6^{1,2,3,4})) }

<colgroup><col></colgroup><tbody>
</tbody>
6
80
162
<--- = SERIESSUM(A6,4,-1,$F$2:$F$5)+$F$6

<colgroup><col></colgroup><tbody>
</tbody>
-0.0000078125

<colgroup><col width="135"></colgroup><tbody>
</tbody>
<--- { =TRANSPOSE(LINEST(B2:B6,A2:A6^{1,2,3,4})) }

<colgroup><col></colgroup><tbody>
</tbody>
7
101
-821.1016015625

<colgroup><col width="135"></colgroup><tbody>
</tbody>
<--- = SERIESSUM(A7,4,-1,$F$2:$F$5)+$F$6

<colgroup><col></colgroup><tbody>
</tbody>
Nil
Nil

<tbody>
-324.0506328125

<colgroup><col width="135"></colgroup><tbody>
</tbody>

</tbody>


As you can tell, I haven't actually used the SERIESSUM and LINEST functions before so I am guessing that this is where I am getting tripped up. Sorry about this!
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top