Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I display a ratio in Excel in the format A:B?

Tags:

I have an Excel spreadsheet of data like:

ColumnA ColumnB
33        11
25        5
6         4

What i would like to do is add a third column which shows the ratio of columnA to columnB in the format of A:B. For example:

ColumnA ColumnB   Ratio
33        11       3:1
25        5    5:1
6         4    3:2

Does anyone know of a way to achieve this?

Thanks in advance.

like image 437
Vincent Avatar asked Jan 23 '09 14:01

Vincent


People also ask

How do you format ratios in Excel?

Method 1: How to Calculate the Ratio in Excel. Calculate Ratio Formula: To calculate the Ratio in excel, the Shop 1 will be divided by GCD and the Shop 2 will be divided by GCD. You can place a colon between those two numbers. Example: To see the ratio, enter this formula in cell E2 = B2/GCD(B2,C2)&”:”&C2/GCD(B2,C2).


1 Answers

Try this formula:

=SUBSTITUTE(TEXT(A1/B1,"?/?"),"/",":")

Result:

A   B   C
33  11  3:1
25  5   5:1
6   4   3:2

Explanation:

  • TEXT(A1/B1,"?/?") turns A/B into an improper fraction
  • SUBSTITUTE(...) replaces the "/" in the fraction with a colon

This doesn't require any special toolkits or macros. The only downside might be that the result is considered text--not a number--so you can easily use it for further calculations.


Note: as @Robin Day suggested, increase the number of question marks (?) as desired to reduce rounding (thanks Robin!).

like image 61
Michael Haren Avatar answered Sep 20 '22 17:09

Michael Haren