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

Discuss the spreadsheet application
Post Reply
aloarjr810
Posts: 48
Joined: Mon May 31, 2010 9:47 pm

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

Post 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
Attachments
speed ratio ver1.ods
Example speed ratio sheet
(9.4 KiB) Downloaded 157 times
Last edited by floris v on Sun Jul 17, 2016 11:23 pm, edited 2 times in total.
Reason: Added green check mark, floris v, moderator
Apache OpenOffice4.1.2, Windows 7
User avatar
floris v
Volunteer
Posts: 4646
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

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

Post 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".
LibreOffice 25.8.4.2 on Ubuntu Linux
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
User avatar
Zizi64
Volunteer
Posts: 11511
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

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

Post by Zizi64 »

You can format the result by the formula:

Code: Select all

=TEXT(A2/B2;"0.00")&":1"
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
aloarjr810
Posts: 48
Joined: Mon May 31, 2010 9:47 pm

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

Post 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"
Apache OpenOffice4.1.2, Windows 7
Post Reply