Documentation/Calc Functions/DOLLAR

    From The Document Foundation Wiki
    Other languages:


    Function name:

    DOLLAR

    Category:

    Text

    Summary:

    Converts a number into text, expressing that number as currency in the local currency format. The number is rounded to a specified number of decimal places.

    Note pin.svg

    Note:
    Do not be misled by the name of this function – the returned string may be in any available currency (for example, dollar, euro, pound, rupee, yen) and currency format. The exact currency and format (including the decimal separator) used by the DOLLAR function are controlled by selections in the Format area of the Tools ▸ Options ▸ Language Settings ▸ Languages dialog or its equivalent under macOS.

    Syntax:

    DOLLAR(Value [; Decimals])

    Returns:

    Returns a text string expressing the given number as currency in the local currency format.

    Arguments:

    Value is a real number or a reference to a cell containing that number, which is the value to be converted.

    Decimals is an integer or a reference to a cell containing an integer, which is the number of decimal places to be used in the returned text. If Decimals is omitted, a default value of 2 is used. If Decimals is positive, the fractional part of Value will be rounded to the specified number of decimal places. If Decimals is negative, the integer part of Value will be rounded to the left of the decimal point.

    • If either Value or Decimals are non-numeric, then DOLLAR reports a #VALUE! error.
    • If Decimals is a non-integer value, then DOLLAR uses its floor value.
    • If the floor value of Decimals is less than -15 or greater than 15, then DOLLAR reports an invalid argument error (Err:502).

    Additional details:

    The operation of DOLLAR depends on locale settings and so it should not be regarded as portable.

    Examples:

    Unless otherwise stated, the results for the following examples assume that:

    • The English (USA) locale setting is selected.
    • Default – USD is selected as the default currency.
    • The option to set the decimal separator key to Same as locale setting has been selected.
    Formula Description Returns
    =DOLLAR(255) Here the function applies the default value of 2 for the omitted Decimals argument, returning the string "$255.00". For the Japanese locale setting and the JPY default currency, the function would return "¥255.00". For the German (Germany) locale and the EUR default currency, the function would return "255,00 €". $255.00
    =DOLLAR(345.678; 2) Here the function rounds the specified value to 2 decimal places, returning the string "$345.68". $345.68
    =DOLLAR(345.678; 2.9) Here the function takes the floor value of the non-integer Decimals argument (2) and rounds the specified value to 2 decimal places, again returning the string "$345.68". $345.68
    =DOLLAR(1234; −2) Here the function rounds to the left of the decimal point, in this case to the nearest 100 currency units, and returns the string "$1,200". For the Japanese locale setting and the JPY default currency, the function would return "¥1,200". For the German (Germany) locale and the EUR default currency, the function would return "1.200 €" $1,200
    =DOLLAR(1234; −1.5) Here the function takes the floor value of the non-integer Decimals argument (-2) and rounds to the left of the decimal point to the nearest 100 currency units, again returning the string "$1,200". $1,200
    =DOLLAR(D1; D2) where cells D1 and D2 contain the values -127.5 and -1 respectively. Here the function rounds to the left of the decimal point, in this case to the nearest 10 currency units, and returns the string "-$130". -$130

    Related LibreOffice functions:

    TEXT

    ODF standard:

    Section 6.20.7, part 2

    Related (or similar) Excel functions:

    DOLLAR