Page 1 of 1

[Solved] How to calculate & display a ratio Ex. 2.69:1

Posted: Sun Jul 17, 2016 5:22 pm
by aloarjr810
I'm trying to have my sheet calculate and display a ratio like this ( Ratio 3:1) of 2 speeds in a single cell.

Example:
Speed A= 17mph
Speed B= 6.32mph
The ratio is 2.69:1

Currently I am trying this formula:

Code: Select all

=A2/GCD(A2;B2)&":"&B2/GCD(A2;B2)
This gives the proper format X:X in the answer cell, But the result is not right.

Example:
Speed A= 17mph
Speed B= 6.32mph
Gives the ratio as 17:6.32
But it should show this 2.69:1

What am I doing wrong?

I'm using OpenOffice 4.1.2

Re: How to calculate & display a ratio Ex. 2.69:1

Posted: Sun Jul 17, 2016 5:51 pm
by floris v
The GCD function should calculate the GCD of two or more integer values, and you enter rational numbers. You don't need the GCD at all in this case.
 Edit: But the formula gave the right result, IF you insist on calculating the GCD of those two numbers, the result will be 1. Instead of the GCD you might want to use the MIN() function. 
If you want the second number to be 1 in cases like this, simply change the formula to =A2/B2&":1" or, if you want integer values, =A2/B2*100&":100".

Re: How to calculate & display a ratio Ex. 2.69:1

Posted: Sun Jul 17, 2016 5:57 pm
by Zizi64
You can format the result by the formula:

Code: Select all

=TEXT(A2/B2;"0.00")&":1"

Re: How to calculate & display a ratio Ex. 2.69:1

Posted: Sun Jul 17, 2016 11:22 pm
by aloarjr810
Thank You
Okay I went this one;

Code: Select all

=A2/B2&":1"
But added the round func. too

Code: Select all

=ROUND(A2/B2;2)&":1"