A Formula To Calculate A Ratio
Category: Formulas | [Item URL]
Excel provides no direct way to display the ratio between two values. For example, assume cell A1 contains 3, and cell B1 contains 24. The ratio between these two values is 1:8.Following is a formula, contributed by Douglas J. Roach, that displays the ratio between the values in cells A1 and B1:
=(LEFT(TEXT(A1/B1,"####/####"),FIND("/",TEXT(A1/B1,"####/####"))-1)&":"
&RIGHT(TEXT(A1/B1,"####/####"),LEN(TEXT(A1/B1,"####/####"))
-FIND("/",TEXT(A1/B1,"####/####"))))
The formula automatically reduces the "fraction" to the simplest form, and it allows up to four characters on either side of the colon.
Jerry Meng pointed out a much simpler formula that produces the same result, but does not have the four-character limit:
=A1/GCD(A1,B1)&":"&B1/GCD(A1,B1)
Jerry's formula uses the GCD function, which is available only when the Analysis Toolpak Add-In is installed.
Note: Be aware that the result of these formulas is a text string, not a fractional value. For example, the ratio of 1:8 is not the same as 1/8.
Excel Tips
Excel has a long history, and it continues to evolve and change. Consequently, the tips provided here do not necessarily apply to all versions of Excel.
In particular, the user interface of the most recent version, Excel 2007, is vastly different from its predecessors. Therefore, the menu commands listed in older tips, will not correspond to the Excel 2007 user interface.
All Tips
Browse Tips by Category
Search for Tips
Tip Books
Needs tips? Here are two books, with nothing but tips:
Contains more than 200 useful tips and tricks for Excel 2007 | Other Excel 2007 books | Amazon link: John Walkenbach's Favorite Excel 2007 Tips & Tricks
Contains more than 200 useful tips and tricks for Excel | Other Excel 2003 books | Amazon link: John Walkenbach's Favorite Excel Tips & Tricks
