1

I am trying to write a sheets document with all kinds of formulas for math, engineering and physics, and I am currently doing a formula for finding out the area of a scalene triangle knowing the three sides the formula is the the square root of:

s(s - a)(s - b)(s - c)

where s is:

a + b + c / 2

and a, b and c is the sides of the triangle.

I have this formula in google sheets:

=SQRT(I64 x (I64-E64) x (I64-F64) x (I64-G64))

where the x is a *, and I can't for the life of me find out what I am doing wrong.

I64 is the semi-parameter, while E, F and G64 is the sides. The formula gives me 0 as the answer, but that's not correct. It is supposed to do the calculations in the parentheses first, which should then be multiplied. So for example, if the sides are 5, 8 and 9, the semi-parameter is 11. The formula should then do something like this:

SQR of 11(11-5)(11-8)(11-9)

SQR of 11(6)(3)(2)

SQR of 396

19.8997....

I have looked into order of operation that google sheets does, and it should begin with parentheses.

I64, or the semi-paremeter, is also a formula, simply adding the sides and diving by 2. I have not had an issue with adding formulas to other formulas like this before, so is there something I am not seeing here?

2
  • Welcome to Web Applications Stack Exchange. Your formula seems correct except for s which should be (a + b + c) / 2. The likely explanation for the zero result is that one of the cell references in your formula is pointing to an empty cell. Consider sharing a publicly editable sample spreadsheet. Sep 16 at 16:12
  • Thank you. It seems the issue was that I64 and H64 was merged, but that I64 somehow did not have the formula in it, even though it was merged with H64. I just changed out the formula with H64 instead of I 64, and it worked. So you were right about one of the cell references was pointing to an empty cell. s was correct in my sheet though, I just forgot to add parenthasees in my question :P
    – user301305
    Sep 16 at 18:11

1 Answer 1

0

the error is where you said:

where s is: a + b + c / 2

s is instead: (a + b + c) / 2

so, if I64 contains the value of 11, the result of

=SQRT(I64 * (I64-E64) * (I64-F64) * (I64-G64))

is: 19.89974874

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.