Description
Errors entered by the user or included in the data source are not parsed as Error. They are interpreted as a string value.
Error syntax
Error ::= '#' [A-Z0-9]+ ([!?] | ('/' ([A-Z] | ([0-9] [!?]))))
Error types
| Name |
Comments |
| #DIV/0! |
Attempt to divide by zero, including division by an empty cell. ERROR.TYPE of 2 6.13.11 |
| #NAME? |
Unrecognized/deleted name. ERROR.TYPE of 5. |
| #N/A |
Not available. ISNA() applied to this value will return TRUE. Lookup functions that failed, and NA(), return this value. ERROR.TYPE of 7. |
| #NULL! |
Intersection of ranges produced zero cells. ERROR.TYPE of 1. |
| #NUM! |
Failed to meet domain constraints (e.g., input was too large or too small). ERROR.TYPE of 6. |
| #REF! |
Reference to invalid cell (e.g., beyond the application’s abilities). ERROR.TYPE of 4. |
| #VALUE! |
Parameter is wrong type. ERROR.TYPE of 3. |
ODFF 1.3 spec
Spec says it's optional:
Evaluators may allow entry of errors directly, parse them and recognize them as Errors. Functions shall propagate Errors unless stated otherwise.
Although, both XL and GS parse them according to spec. LC does it if = is present.
Example test
it('Errors should be parsed and propagated', () => {
const engine = HyperFormula.buildFromArray([
['#DIV/0!', '=A1', '=ISERROR(B1)', '=ISERROR(#DIV/0!)', '=#DIV/0!'],
])
expect(engine.getCellValue(adr('A1'))).toBe(new CellError(ErrorType.DIV_BY_ZERO))
expect(engine.getCellValue(adr('B1'))).toBe(new CellError(ErrorType.DIV_BY_ZERO))
expect(engine.getCellValue(adr('C1'))).toBe(true)
expect(engine.getCellValue(adr('D1'))).toBe(true)
expect(engine.getCellValue(adr('E1'))).toBe(new CellError(ErrorType.DIV_BY_ZERO))
})
Other requirements
An unknown Error name shall be mapped into an Error supported by the evaluator when read (e.g., the application's equivalent of #NAME?), though an evaluator may warn the user if this has or will take place. It is desirable to preserve the original specific Error name when writing an Error back out, where possible, but for Errors other than #N/A evaluators may write a different Error for a formula than they did when reading it. Whitespace shall not be included in an Error name.
Evaluators should use a human-comprehensible name, not a numeric id, for Error names they write.
Description
Errors entered by the user or included in the data source are not parsed as Error. They are interpreted as a string value.
We may refactor(see CellError does not provide localized error value that should be displayed in a cell #48)error.typeto use enum as numbersWe may add(see CellError does not provide localized error value that should be displayed in a cell #48)error.valueto return translated string as valueShould we parse only the error cells that start withNo=?Error syntax
Error ::= '#' [A-Z0-9]+ ([!?] | ('/' ([A-Z] | ([0-9] [!?]))))Error types
ODFF 1.3 spec
Spec says it's optional:
Although, both XL and GS parse them
according to spec. LC does it if=is present.Example test
Other requirements