1

I am trying to figure out the 2 order equation (Y = ax^2 + bx + c) for a set of data values. When I use the inbuilt function in excel

=LINEST(C2533:C2537,B2533:B2537^{1,2}) 

I get the following result for the datas I have choosen

3.08414E-09 -0.00041244 7.351136804

But when I try the same in Excel VBA code the answers do not co-relate can any one tell me what should the modification in code?

Set RangeM = ("C2533:C2537")  -->Y axis
Set RangeF = ("B2533:B2537") --> Xaxis
Mpolynomials = Application.WorksheetFunction.LinEst(RangeM, RangeF, True, True)
  • : Mpolynomials(1) : : Variant(1 to 2) : Mpolynomials(1,1) : -2.88227749032385E-04 : Variant/Double : Mpolynomials(1,2) : 6.10919130371322 : Variant/Double
  • : Mpolynomials(2) : : Variant(1 to 2) : Mpolynomials(2,1) : 2.49037160577299E-06 : Variant/Double : Mpolynomials(2,2) : 0.050203149944234 : Variant/Double
  • : Mpolynomials(3) : : Variant(1 to 2) : Mpolynomials(3,1) : 0.999776086266518 : Variant/Double : Mpolynomials(3,2) : 9.34516966780855E-03 : Variant/Double
  • : Mpolynomials(4) : : Variant(1 to 2) : Mpolynomials(4,1) : 13395.0169654829 : Variant/Double : Mpolynomials(4,2) : 3 : Variant/Double
  • : Mpolynomials(5) : : Variant(1 to 2) : Mpolynomials(5,1) : 1.16981624866201 : Variant/Double : Mpolynomials(5,2) : 2.61996588360387E-04 : Variant/Double

1 Answer 1

1

I did some browsing and obtained the way to get the polynomials for the second order equation

Mpolynomials = Application.WorksheetFunction.LinEst(RangeM, Application.Power(RangeF, Array(1, 2)))

Here Mpolynomials is a Variant

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .