Documentation/Calc Functions/DOLLARFR

    From The Document Foundation Wiki
    Other languages:

    Function name:

    DOLLARFR

    Category:

    Financial Analysis

    Summary:

    Converts a decimal dollar value into a fractional dollar representation.

    Fractional dollar representations are sometimes used when quoting security prices to the nearest fraction of a dollar (for example, rounding to the nearest 1/8, 1/16, or 1/32 part of a dollar). A value expressed in a fractional dollar representation has an integer part, a decimal separator, and a fraction part. However, such numbers cannot be treated mathematically as a standard decimal number.

    For example, if quoting a security price to the nearest 1/32 of a dollar using decimal representation, the value 2.5 would be equivalent to 2 + 16/32 = 2.16 in fractional dollar representation. Note that simply quoting a value in a fractional dollar representation is meaningless if the denominator of the fraction is not known.

    Syntax:

    DOLLARFR(Decimal dollar; Fraction)

    Returns:

    Returns a real number, which is the decimal dollar value converted to a fractional dollar representation. Note that the returned value is not by default displayed as a currency.

    Arguments:

    Decimal dollar is a real number, or a reference to a cell containing that number, which is the decimal dollar value.

    Fraction is a positive integer, or a reference to a cell containing that integer, which is the denominator of the fraction. This value is essential to convert to a fractional dollar representation. For example, if values are rounded to the nearest 1/8 of a dollar, the value of Fraction would be 8.

    • If either argument is non-numeric, then DOLLARFR reports a #VALUE! error.
    • If Fraction is a non-integer value, then DOLLARFR truncates it to an integer value.
    • If after any truncation Fraction is less than or equal to 0, then DOLLARFR reports an invalid argument error (Err:502).

    Additional details:

    • The formula for DOLLARFR is:
    [math]\displaystyle{ \text{DOLLARFR}(val_d;\:d) ~=~ \text{TRUNC}(val_d) \:+\: \left( {val_d-\text{TRUNC}(val_d)} \right)\:\times \: d }[/math]
    where vald is the decimal dollar value (Decimal dollar argument) and d is the denominator of the fraction to be used (Fraction argument).
    • The DOLLARDE function performs the reverse transformation, converting a value in fractional dollar representation to a decimal dollar representation.

    Examples:

    Formula Description Returns
    =DOLLARFR(A1; A2) where cells A1 and A2 contain the values 1.25 and 16 respectively. Here the function converts the value 1.25 in decimal dollar representation to its corresponding value in fractional dollar representation, based on a denominator of 16. The function calculates the result as 1.04. 1.04
    =DOLLARFR(1.0; 16) Here the function converts the value 1.0 in decimal dollar representation to its corresponding value in fractional dollar representation, based on a denominator of 16. The function calculates the result as 1. Note that since the first argument has no fractional component, then the exact value of the second argument is not significant to the returned value, although it must still be greater than or equal to 1. 1
    =DOLLARFR(1.125; 8.2) Here the function converts the value 1.125 in decimal dollar representation to its corresponding value in fractional dollar representation, based on a denominator of 8 (the original value 8.2 is truncated). The function calculates the result as 1.1. 1.1
    =DOLLARFR(−1.25; 32) Here the function converts the value -1.25 in decimal dollar representation to its corresponding value in fractional dollar representation, based on a denominator of 32. The function calculates the result as -1.08. −1.08
    =DOLLARFR(2.25; 16) Here the function converts the value 2.25 in decimal dollar representation to its corresponding value in fractional dollar representation, based on a denominator of 16. The function calculates the result as 2.04. 2.04
    =DOLLARFR(1.43125; 8) Here the function converts the value 1.43125 in decimal dollar representation to its corresponding value in fractional dollar representation, based on a denominator of 8. The function calculates the result as 1.345. 1.345

    Related LibreOffice functions:

    DOLLARDE

    TRUNC

    ODF standard:

    Section 6.12.17, part 2

    Related (or similar) Excel functions:

    DOLLARFR