View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis[_3_] Dana DeLouis[_3_] is offline
external usenet poster
 
Posts: 690
Default VBA coefficients of an equation

What I actually want is something which looks like this
http://phpaw.com/myscrpit/milt-up/jp...1124615026.jpg


Hi. Just want to point out that the link shows an answer of 0.02

7/392 equals about 0.02, but the equation is

7/Sqrt(392), which I think should be equal to about 0.35
Is the equation correct?

--
Dana DeLouis
Win XP & Office 2003


"Ali Baba" wrote in message
...
Thanks deanop and bill

What I actually want is something which looks like this
http://phpaw.com/myscrpit/milt-up/jp...1124615026.jpg

So the task of the program is to select the number of variables then enter
their details and the SM equation. from this we would be able to
calculate
the answer

I don't know if there is another way to do this. deanop, you have
suggested
that i ask the user to input the coefficients, how would the form look
like??



"deanop" wrote:

as promised here is the code revised to include square function

Sub coeffxi()
Dim i As Integer
Dim Prod_array(1 To 4)
Set Coeff = Range("c3:C6")
Set xi = Range("d3:d6")
Range("C8").Value = "Y ="
Range("D8").Value = Application.SumProduct(Coeff, xi)
For i = 1 To 4
Prod_array(i) = Coeff(i) * xi(i)
Next
Range("C9").Value = "SumSQ ="
Range("D9").Value = Application.SumSq(Prod_array)
End Sub

cheers,deano