mhess
(Mhess)
April 14, 2026, 12:56pm
1
Hello,
I’m having an issue with a formula and I’m hoping someone can point me in the right direction on what’s going on. I’m parsing an excel spreadsheet. The formula is “=IFS(C5<C7,“Pass”,C5>=C7,“Fail”)” and it works fine in excel, but shows up as #ERROR !” when shown in my react website. I was able to output the formula and it’s showing. “Parsing error. Redundant input, expecting EOF but found: (“
I also outputted the value and it looks like this: “=_xlfn.IFS(C5<C7,“Pass”,C5>=C7,“Fail”)” which appears to be fine.
Any help is much appreciated.
Thanks,
Mike
Hi @mhess , thanks for reporting this issue. I believe this is due to the parser failing when it encounters the _xlfn. prefix that Excel adds to certain functions for backwards compatibility. I’ll review this with the team and update this thread when I have more info.
For now, you can just strip out the _xlfn. prefix before passing the formula:
formula.replace(/_xlfn\./g, '')
There are a few other prefixes that Excel uses. Here’s a regex to remove them all:
formula.replace(/_xlfn\.SINGLE\.|_xlfn\._xlws\.|_xlfn\.|_xlws\.|_xlpm\./g, '')
Hope this helps! Thanks again for reporting the issue. Please let me know if you still see the same error after removing the _xlfn prefix.
mhess
(Mhess)
April 16, 2026, 4:48pm
3
Just wanted to write a follow up, thank you for your help, doing the replace did solve the issue.
Thanks again,
Mike
1 Like
Awesome, glad to hear it! Thanks for following up.
Here’s the issue in GitHub. I’ll close out this topic once the fix is live.
opened 03:03PM - 15 Apr 26 UTC
Bug
Impact: High
PublicRoadmap
### Description
HyperFormula fails to parse formulas containing Excel's interna… l function prefixes. These prefixes are present in the raw XML of every .xlsx file for any function added after the original OOXML spec (~Excel 2007) and affect 180+ functions including commonly used ones like IFS, SWITCH, XLOOKUP, CONCAT, TEXTJOIN, MAXIFS, and FILTER.
Users who parse .xlsx files with libraries like SheetJS or ExcelJS get the raw prefixed formula strings (e.g., =_xlfn.IFS(C5<C7,"Pass",C5>=C7,"Fail")). Passing these to HyperFormula produces:
Parsing error. Redundant input, expecting EOF but found: (
Every major spreadsheet library (SheetJS, ExcelJS, openpyxl, Apache POI, LibreOffice) strips these prefixes on import. HyperFormula currently does not.
**Root cause**
The `ProcedureName` token in `src/parser/LexerConfig.ts` requires the first character to be a letter:
```
pattern: new RegExp(`([${UNICODE_LETTER_PATTERN}][${NON_RESERVED_CHARACTER_PATTERN}]*)\\(`)
// UNICODE_LETTER_PATTERN = 'A-Za-z\u00C0-\u02AF' — no underscore
```
Since every Excel internal prefix starts with `_`, none of them match as a function name. The lexer tokenizes the prefix as something else, then reports "expecting EOF but found (".
Reproduction
```
const hf = HyperFormula.buildFromSheets({
Sheet1: { cells: [[{ cellValue: 10 }, {}, { cellValue: 5 }]] } // A1=10, C1=5
});
// Works
hf.setCellContents({ sheet: 0, row: 0, col: 3 }, [['=IFS(A1>C1,"Pass",A1<=C1,"Fail")']]);
hf.getCellValue({ sheet: 0, row: 0, col: 3 }); // "Pass"
// Fails — same formula with Excel's internal prefix
hf.setCellContents({ sheet: 0, row: 0, col: 3 }, [['=_xlfn.IFS(A1>C1,"Pass",A1<=C1,"Fail")']]);
hf.getCellValue({ sheet: 0, row: 0, col: 3 }); // CellError: Parsing error
```
Verified against HyperFormula 3.2.0.
Prefixes to strip
All of these produce the same parse error and should be stripped before lexing:
Prefix Introduced Meaning Example
_xlfn. Excel 2010 Future functions _xlfn.IFS(...), _xlfn.XLOOKUP(...)
_xlfn._xlws. Excel 365 Future + worksheet-scoped _xlfn._xlws.FILTER(...)
_xlws. Excel 365 Worksheet-scoped _xlws.SORT(...)
_xlpm. Excel 365 LAMBDA/LET parameter names _xlpm.x inside a LAMBDA body
_xludf. Excel 365 User-defined (LAMBDA in Name Manager) _xludf.MyCustomFn(...)
All verified to fail against HyperFormula 3.2.0 with the same "Parsing error. Redundant input, expecting EOF but found: (" error.
Suggested fix
A formula preprocessing step that strips the prefixes before they reach the lexer:
`formula.replace(/_xlfn\._xlws\.|_xlfn\.|_xlws\.|_xlpm\.|_xludf\./g, '')
`
(Longer prefixes ordered first so _xlfn._xlws. matches fully rather than being partially consumed by _xlfn..)
This is low risk — these prefixes are serialization artifacts, not real function names, and stripping them is the standard approach used by every other spreadsheet engine.
Raised in passing in #1392 but never addressed. Also reported on the Handsontable [forum](https://forum.handsontable.com/t/error-message-when-using-ifs-function/9057) by users importing .xlsx files.
### Video or screenshots
_No response_
### Demo
https://forum.handsontable.com/t/error-message-when-using-ifs-function/9057
### HyperFormula version
3.2
### Your framework
_No response_
### Your environment
Chrome on MacOS