Documentation/Calc Functions/ARABIC

    From The Document Foundation Wiki
    Other languages:


    Function name:

    ARABIC

    Category:

    Text

    Summary:

    Converts a Roman numeral to its equivalent decimal number.

    Note pin.svg

    Note
    Decimal numbers are written using the ten digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. These are known as (Western) Arabic numerals, which leads to the name of this function. The ARABIC function has no connection to other numerals used in Arabic writing, such as the Eastern Arabic numerals.

    Syntax:

    ARABIC(Text)

    Returns:

    Returns an integer in the range 0 ≤ n ≤ 3999 which is the decimal value that is equivalent to the specified Roman numeral.

    Arguments:

    Text is a text string (in quotation marks) representing a valid Roman numeral, or a reference to a cell containing such a string, that is to be converted to its equivalent decimal number.

    • Text can be an empty string, in which case ARABIC returns the value 0.
    • If not empty, Text must be a string containing a sequence of the characters "I", "V", "X", "L", "C", "D", and "M", or their lowercase equivalents. If Text is not a string, or contains any character other than those listed, then ARABIC reports an invalid argument error (Err:502).
    • If Text is a string representing a Roman numeral that corresponds to a decimal value greater than 3999, then ARABIC reports an invalid argument error (Err:502).

    Additional details:

    The following table lists the characters that can be used to construct a Roman numeral suitable for passing to ARABIC. Note that uppercase and lowercase characters are interchangeable.


    Valid Roman numeral symbols
    Symbol Decimal value
    "M" or "m" 1000
    "D" or "d" 500
    "C" or "c" 100
    "L" or "l" 50
    "X" or "x" 10
    "V" or "v" 5
    "I" or "i" 1

    There are various rules that can be applied to determine how a Roman numeral should be constructed and these may be strengthened or relaxed depending on circumstance. To cater for this potential flexibility, Calc’s ROMAN function has an optional Mode parameter that controls how different output strings can be obtained for the same input decimal number. When creating a string of Roman numerals for passing to the ARABIC function, the following should be kept in mind.

    • ARABIC will successfully decode any Roman numeral output from Calc's ROMAN function. The formula =ARABIC(ROMAN(x; n)) is valid, and returns the value x, for any x in the range 0 <= x <= 3999 and any n in the range 0 <= n <= 4.
    • Wikipedia’s Roman numerals page includes general guidance on the construction of Roman numerals.

    Examples:

    Formula Description Returns
    =ARABIC("") Here the function returns the value 0. 0
    =ARABIC("XXV") Here the function returns the value 25. 25
    =ARABIC("MDCCCXV") Here the function returns the value 1815. 1815
    =ARABIC("MMXXI") Here the function returns the value 2021. 2021
    =ARABIC("CMXCIX") Here the function returns the value 999. Note that the following arguments all cause the same value to be returned – "LMVLIV", "XMIX", "VMIV", and "IM". 999

    Related LibreOffice functions:

    ROMAN

    ODF standard:

    Section 6.19.2, part 2

    Related (or similar) Excel functions:

    ARABIC since v.2013.