|
- Charts - Formula - Printing
|
A Formula to Calculate a RatioExcel 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,"####/####")) 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.
|