PrecisionCalc
xl
Precision
Get Your Numbers Right
xlpREDUCEFRACTION
Reduces a fraction to the smallest possible numerator and denominator by finding the largest divisor of both numbers, with up to 32,767 significant digits of precision.
By default, returns a string formatted as <numerator>/<denominator>. Can also return numerator only, or denominator only, or the divisor by which the fraction was reduced. Or, can return an array with all four return values in an array of four cells.
To return all four values in an array of four cells, the formula must be array-entered. To array-enter an xlpREDUCEFRACTION formula, follow these steps:
- Select the four cells in which you want the four return values. The four cells must be either four horizontally adjacent cells (such as A1:D1), or four vertically adjacent cells (such as A1:A4).
- With the four cells selected, type the formula in the first (top or left) of the selected cells.
- With the four cells still selected, press and hold down the CTRL and SHIFT keys.
- With the four cells still selected, and with the CTRL and SHIFT keys still held down, press Enter.
- You should see the formatted reduced formula (<numerator>/<denominator>) in the first cell, the reduced numerator in the second cell, the reduced denominator in the third cell, and the divisor used to reduce the fraction in the fourth cell.
Syntax
xlpREDUCEFRACTION(numerator,denominator,simplify_signs,always_simplify_fraction,return_numerator,return_denominator,return_reduced_by,fraction_separator)
numerator | Required. The numerator of the fraction to be reduced. |
denominator | Required. The denominator of the fraction to be reduced. |
simplify_signs | Optional. Set to TRUE to simplify the positive and negative signs of the numerator and denominator. If both were negative, turns both positive. If denominator was negative and numerator was positive, turns denominator positive and numerator negative. If either numerator or denominator is 0, turns all signs positive. False by default. |
always_simplify_fraction | Optional. Set to TRUE to simplify the fraction by multiplying by factors of 10 until both numerator and denominator are integers. The simplified fraction is then reduced as much as possible, but the result may not be a reduction relative to the original fraction. False by default. |
return_numerator | Optional. Set to TRUE to return only the numerator of the reduced fraction. Omit or set to FALSE if array-entering formula to return all four values in an array of four cells. |
return_denominator | Optional. Set to TRUE to return only the denominator of the reduced fraction. Ignored if return_numerator is true. Omit or set to FALSE if array-entering formula to return all four values in an array of four cells. |
return_reduced_by | Optional. Set to TRUE to return only the divisor used to reduce the fraction. Ignored if return_numerator or return_denominator is true. Omit or set to FALSE if array-entering formula to return all four values in an array of four cells. return_divisor is true. |
fraction_separator | Optional. Sets the character or string of characters to be used to separate the numerator and denominator. Slash ("/") by default. |
Remarks
numerator and denominator may be positive or negative.
numerator and denominator can accept cells with both numbers and text.
numerator and denominator can accept cells with text formatted with the local currency symbol and thousands separators, and negatives can be formatted with either a leading hyphen or parentheses.
fraction_separator can accept any text character or string of text characters.
xlPrecision results are returned as text that look like numbers, not as values that Excel recognizes as numbers. This is because Excel would truncate the results to 15 significant digits if it recognized them as numbers.
You can use the results of xlPrecision functions as the operands in other xlPrecision formulas without losing any precision, but using them as operands in Excel's arithmetic functions will truncate them to 15 significant digits.
If the return value is so large that it has more than 32,767 characters to the left of the decimal, then xlPrecision is of course unable to return a correct value and instead returns "#VALUE!". Note, that's a vastly larger number than Excel can return without xlPrecision. Excel itself can only return or recognize a number with no more than 308 digits to the left of the decimal.
The 32,767 SD edition can only provide a maximum of 32,767 total characters, including all formatting characters such as decimal, leading hyphen or parentheses for negatives, and thousands separators. As a result, it can only return the maximum 32,767 significant digits when the result is an unformatted positive integer. This is due to Excel's limitation of 32,767 characters in a cell. In all cases, the 32,767 SD edition will give you as many significant digits as possible with the formatting you have chosen.
Depending on how many significant digits the edition of xlPrecision provides, the result may be too long to conveniently view. You can view the full result by right-clicking the cell and choosing Format Cells | Alignment | Wrap Text, and widening the column to the width of the screen. An easy way to view the full result without changing column widths or wrapping text is to right-click the cell, choose Copy, and then paste into Notepad or a word processor.
Examples
Formula | Description | Result |
=xlpREDUCEFRACTION(5,10) | Reduce 5/10 | 1/2 |
=xlpREDUCEFRACTION(221,-793) | Reduce 221/(-793) | 17/-61 |
=xlpREDUCEFRACTION(221,-793,TRUE) | Reduce 221/(-793), and simplify signs | -17/61 |
=xlpREDUCEFRACTION(0,-3,TRUE) | Reduce 0/(-3), and simplify signs | 0/3 |
=xlpREDUCEFRACTION(2.5,10) | Reduce 2.5/10 | 1/4 |
=xlpREDUCEFRACTION(2.6,10) | Reduce 2.6/10 | 2.6/10 |
=xlpREDUCEFRACTION(2.6,10,,TRUE) | Reduce 2.6/10, and simplify (even if reduced simplification is not a reduction of the original) | 13/50 |
=xlpREDUCEFRACTION(98,266,,,TRUE) | Reduce 98/266, and return reduced numerator | 7 |
=xlpREDUCEFRACTION(98,266,,,,TRUE) | Reduce 98/266, and return reduced denominator | 19 |
=xlpREDUCEFRACTION(98,266,,,,,TRUE) | Reduce 98/266, and return the divisor by which the fraction was reduced | 14 |
=xlpREDUCEFRACTION(5,10,,,,,," / ") | Reduce 5/10, and separate the numerator and denominator by the string " / " (space, slash, space) | 1 / 2 |