Skip to content

Commit

Permalink
Fix XLOOKUP for scenario with 2D returnArray
Browse files Browse the repository at this point in the history
  • Loading branch information
sequba committed Dec 5, 2024
1 parent d3c6a26 commit af99365
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/interpreter/plugin/LookupPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,19 +147,16 @@ export class LookupPlugin extends FunctionPlugin implements FunctionPluginTypech
}

public xlookupArraySize(ast: ProcedureAst, state: InterpreterState): ArraySize {
if (ast?.args?.length !== 5) {
return ArraySize.error()
}

const lookupRangeValue = ast?.args?.[1] as CellRange
const returnRangeValue = ast?.args?.[2] as CellRange

if ([
lookupRangeValue.start,
returnRangeValue.start,
lookupRangeValue.end,
returnRangeValue.end
].some((val) => val === undefined)) {
if (lookupRangeValue == null
|| lookupRangeValue.start == null
|| lookupRangeValue.end == null
|| returnRangeValue == null
|| returnRangeValue.start == null
|| returnRangeValue.end == null
) {
return ArraySize.error()
}

Expand Down

0 comments on commit af99365

Please sign in to comment.