Math and trigonometry functions
ARABIC
Matches all 3 recorded answers
Recorded: 3 workbook cells. How we measure this · See the Rust code
Local names in 40 languages
| Language | Name in Excel |
|---|---|
| Arabic | ARABIC |
| Bulgarian | ARABIC |
| Czech | ARABIC |
| Danish | ARABISK |
| German | ARABIC |
| Greek | ARABIC |
| English (Australia) | ARABIC |
| English (United Kingdom) | ARABIC |
| English (United States) | ARABIC |
| Spanish | NUMERO.ARABE |
| Estonian | ARABIC |
| Finnish | ARABIA |
| French | ARABE |
| Hebrew | ARABIC |
| Croatian | ARABIC |
| Hungarian | ARAB |
| Indonesian | ARABIC |
| Italian | ARABIC |
| Japanese | ARABIC |
| Korean | ARABIC |
| Lithuanian | ARABIC |
| Latvian | ARABIC |
| Norwegian | ARABIC |
| Dutch | ARABIC |
| Polish | ARABSKIE |
| Portuguese (Brazil) | ÁRABE |
| Portuguese (Portugal) | ÁRABE |
| Romanian | ARABIC |
| Russian | АРАБСКОЕ |
| Slovak | ARABIC |
| Slovenian | ARABŠČINA |
| Serbian (Latin) | ARAPSKI |
| Swedish | ARABIC |
| Thai | ARABIC |
| Turkish | ARAP |
| Ukrainian | ARABIC |
| Vietnamese | ARABIC |
| Chinese (Simplified) | ARABIC |
| Chinese (Hong Kong) | ARABIC |
| Chinese (Traditional) | ARABIC |
Names from Microsoft's support site.
What it does
ARABIC(text)
ARABIC(text) reads a Roman numeral and returns its value as a number.
Roman numeration is non-positional. A digit's contribution does not depend on where it sits in a place-value column; it depends on the digit itself and on whether a larger digit follows it. The seven symbols and their values:
| Symbol | I | V | X | L | C | D | M |
|---|---|---|---|---|---|---|---|
| Value | 1 | 5 | 10 | 50 | 100 | 500 | 1000 |
The standard evaluation rule is one pass, right to left or left to right, with a single comparison:
value(s) = sum over i of +v(i) if v(i) >= v(i+1)
-v(i) if v(i) < v(i+1)
where v(i) is the value of the i-th symbol and the last symbol always contributes positively.
That rule reads IX as -1 + 10 = 9 and XI as 10 + 1 = 11. It is the rule every
implementation uses, and it is far more permissive than the notation people think of as Roman: it
happily evaluates IIX as 8, VV as 10, and IM as 999, none of which is classical usage.
This is the mathematically important fact about ARABIC: the map from strings to numbers is
many-to-one and its domain is a matter of choice, not of arithmetic. There is no canonical Roman
grammar — the subtractive forms IV, IX, XL, XC, CD, CM were never universal in Roman
practice, and modern "rules" are a nineteenth-century tidying. So a function that converts Roman to
decimal has to decide how permissive to be, and that decision is behaviour, not mathematics.
ARABIC is therefore best understood as a parser with an undocumented grammar. What the grammar
accepts is the whole content of this function, and none of it is documented on any page the
Handbook has retrieved.
Arguments
| Argument | Meaning | Default |
|---|---|---|
text | The Roman numeral to convert. Required. | — |
Microsoft's Learn reference types the argument as String and describes it as "the Roman numeral that you want to convert", and types the return as Double. That is the entirety of the documentation retrieved for this function: no grammar, no case rule, no length limit, no range, no sign handling, and no error condition.
Try it
Quirks
Result and edge cases
Returns Number.
The questions that decide this function's behaviour, and the state of each:
Every row in that table is a real behavioural fact that a formula can depend on, and every one of them is currently unpublished. This page states the shape of the ignorance rather than filling it in.
Errors
The condition column is deliberately vague because the grammar is unknown. "Not admissible" is precisely as specific as the published record allows, and sharpening it is what the probe list below is for.
How to implement
Notes for implementers
The one-pass rule is the whole algorithm, and it is three lines. The interesting work is entirely in deciding what to reject before running it.
Validation is a policy, not a correctness requirement. A permissive implementation runs the
sum and returns a number for anything built from the seven letters. A strict one enforces the
classical constraints: at most three consecutive repeats of I, X, C, M; no repeats of V,
L, D; only I before V or X, only X before L or C, only C before D or M; at
most one subtractive pair per magnitude. Both are defensible. They differ on a large set of inputs,
and which one Excel implements is unknown here.
Case folding. If the function is case-insensitive, that is an invariant fold, not a locale one — the seven letters are all ASCII and have no Turkish-i style hazard. If it is case-sensitive, that is a decision worth documenting. Neither is on record.
Exactness. Every reachable value is a small integer, well inside the exactly-representable range of binary64, so there is no rounding question anywhere in this function. That is unusual for a math-category surface and is worth stating so that readers do not go looking for one.
Failure kind. A parser has two failure modes — "these characters are not in the alphabet" and "these characters are in the alphabet but not in this order" — and an implementation should decide whether they produce the same error. If they do, a caller cannot tell a typo from a non-canonical spelling.
Round-trip as the test harness. ARABIC(ROMAN(n, f)) over all n in range and all f is a
complete self-consistency suite that requires no oracle, and it is the cheapest way to find
disagreements between a pair of implementations.
Rust code
Show the CalcFunc source of this function
Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.
ARABIC · 4 lines · calc-func/src/catalogue/math.rs on GitHub41 arabic "ARABIC" (1, 1) [V "text"] |s, a, sv| {
let t = text(s, a, 0)?;
out(s, k::arabic_fn::arabic_kernel(&ExcelText::from_interop_assignment(&t)))
}
roman_value · 12 lines · calc-func/src/ported/arabic_fn.rs on GitHubfn roman_value(ch: char) -> Option<i64> {
match ch {
'I' => Some(1),
'V' => Some(5),
'X' => Some(10),
'L' => Some(50),
'C' => Some(100),
'D' => Some(500),
'M' => Some(1000),
_ => None,
}
}
arabic_kernel · 18 lines · calc-func/src/ported/arabic_fn.rs on GitHubpub fn arabic_kernel(text: &ExcelText) -> Result<f64, WorksheetErrorCode> {
let s = String::from_utf16_lossy(text.utf16_code_units()).to_uppercase();
if s.is_empty() {
return Ok(0.0);
}
let mut total = 0i64;
let mut prev = 0i64;
for ch in s.chars().rev() {
let value = roman_value(ch).ok_or(WorksheetErrorCode::Value)?;
if value < prev {
total -= value;
} else {
total += value;
prev = value;
}
}
Ok(total as f64)
}
Argument and result plumbing
No implementation has been published with a Handbook test suite for this function.
Version differences
No comparison between specific Excel builds is recorded here yet. This does not establish that all builds behave alike.
Alternatives
Relationships
ROMAN— the counterpart in the other direction, and not an inverse.ROMANtakes an optionalformargument selecting among several degrees of abbreviation, so it is one-to-many;ARABICis many-to-one.ARABIC(ROMAN(n))should recovernfor every form and everynin range, and that round trip is the best available consistency test for the pair.ROMAN(ARABIC(s))does not recoversin general, because non-canonical spellings normalise away.DECIMAL— the positional counterpart: text in a stated radix to a number.ARABICis the non-positional member of the same job.DECIMALshares this surface's evidence record.BASE—DECIMAL's inverse, and therefore the positional analogue ofROMAN.VALUEandNUMBERVALUE— the general text-to-number readers, which do not understand Roman numerals at all.- Confused with: the Arabic language or Arabic-Indic digits. The function name refers to Arabic numerals in the ordinary English sense — the digits 0-9 — and has nothing to do with locale or script.
Named variants
No named variants are recorded yet.
Suggest a correction or contribute an implementation · For agents