This topic is locked
[SOLVED]

 maths

8/30/2011 8:19:42 PM
PHPRunner General questions
J
johndf author

Hello all can anyone help with some advance maths?

I have 3 input columns on a sheet, (The 4th is just a calculated field and a result from the other 3)

Col1, Col2,Col3,Col4

The first formula works fine as (d=a+c) code snippet on the edit sheet as:

$data;

$value = ([“Col1”] + ([“Col2”]);

I am struggling with the next level of formula as

D=A+BC

Col4 = Col1+Col2
Col3

What would that code snippet look like ..I have tried a few in vain?

Any ideas
(((Remembering the rules of “order of operations” sometimes called “operator precedence” or I remember it as BODMAS and 1+2*3=7)))
cheers

C
cgphp 8/30/2011
$value = $data['Col1'] + ($data['Col2'] * $data['Col3']);
J
johndf author 8/31/2011


$value = $data['Col1'] + ($data['Col2'] * $data['Col3']);



Fantastic that works

but how about D=(AC)/(BC)

C
cgphp 8/31/2011
$value = ($data['Col1'] * $data['Col3']) / ($data['Col2'] * $data['Col3']);
J
johndf author 9/1/2011

Very Nice that works as well

I get it now

Thanks for the lesson (I am sure all of the engineers out there just learnt something)