Skip to content

Commit 74c4397

Browse files
Fix: HF-85 propagate CellError from criteria header cells
Per Cursor Bugbot review and Excel behavior — when a criteria header cell evaluates to a CellError (e.g., #REF!, #DIV/0!), the D-function should return that error rather than silently mapping the column to -1 and continuing. This aligns the header-cell behavior with the data cell behavior at the same location (lines 535-537), which already propagated CellError.
1 parent 09a0585 commit 74c4397

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/interpreter/plugin/DatabasePlugin.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,14 @@ export class DatabasePlugin extends FunctionPlugin implements FunctionPluginType
502502
const criteriaData = criteria.data
503503
const criteriaHeaders = criteriaData[0]
504504

505+
// Propagate errors from criteria header cells (Excel returns the header
506+
// error when the D-function is evaluated, instead of silently skipping).
507+
for (const criteriaHeader of criteriaHeaders) {
508+
if (criteriaHeader instanceof CellError) {
509+
return criteriaHeader
510+
}
511+
}
512+
505513
// Map each criteria column to a database column index (or -1 if no match)
506514
const criteriaColumnMapping: number[] = criteriaHeaders.map(criteriaHeader => {
507515
if (typeof criteriaHeader !== 'string') {

0 commit comments

Comments
 (0)