Formula Errors

Fix Recursive LAMBDA and LET Array Errors in WPS Spreadsheets

Emma BrownEmma Brown Nov 13, 2026 869 views

Question details

The user needs to correct a recursive LAMBDA formula in which a LET variable changes from scalar to array during recursion, causing VSTACK to return mismatched dimensions and #N/A errors.

Fix Recursive LAMBDA and LET Array Errors in WPS Spreadsheets
Product
WPS Spreadsheets
Device & OS
not provided
Scenario
Creating a recursive LAMBDA with LET and VSTACK to accumulate results across recursion levels.
Observed behavior
The LET variable next starts as a scalar, becomes an array in later recursion, and VSTACK returns #N/A or mismatched array dimensions.
Before you start

Open the workbook in WPS Spreadsheets and enable the formula bar. In the Formulas tab, open Name Manager to locate the LAMBDA definition you need to inspect and edit.

Solution 1Recommended

Guard the VSTACK result when a LET variable can become an array

Use this when the recursive LAMBDA returns #N/A because the LET variable next changes from scalar to array between branches.

Recursive LAMBDA formulas often fail in VSTACK when the IF branches return arrays with different row counts. Checking the combined result before stacking lets you keep the output shape consistent and avoid dimension mismatches.

1
Open Name Manager in WPS Spreadsheets

Go to the Formulas tab and click Name Manager. Select the defined LAMBDA name from the list, then click Edit to open its formula.

2
Find the VSTACK call inside the LET expression

In the LAMBDA formula, locate the LET variable, for example next, and the VSTACK expression that processes it.

3
Wrap the variable with an error-safe shape test

Change the formula to test the combined result before stacking, for example: =IF(ISERROR(CONCAT(next)),"xx",VSTACK("xx",next)). This returns a scalar branch when next is a scalar and an array branch only when it is safe to stack.

4
Confirm and recalculate

Click OK or press Enter, then recalculate the sheet with F9. Verify that the recursive results no longer show #N/A or dimension mismatches.

Guard the VSTACK result when a LET variable can become an array
Recommended fix: This guard keeps the IF branches compatible when the LET variable changes from scalar to array during recursion.
Spreadsheet formula fix

Fix recursive LAMBDA and LET array errors in WPS Spreadsheets

Open the affected workbook in WPS Spreadsheets, edit the LAMBDA definition in Name Manager, and add a shape guard before VSTACK. WPS Spreadsheets supports LET, LAMBDA, and VSTACK, so you can correct the formula while keeping Excel workbook compatibility.

  1. 1. Open the problematic workbook: Launch WPS Spreadsheets, click Menu in the top-left corner, choose Open, and select the .xlsx or .xlsm workbook that contains the recursive LAMBDA formula.
  2. 2. Open the LAMBDA definition: Click the Formulas tab, select Name Manager, find the LAMBDA name in the list, and click Edit to view its formula.
  3. 3. Add the VSTACK guard: Inside the LET expression, replace the stacking expression with a guarded test such as =IF(ISERROR(CONCAT(next)),"xx",VSTACK("xx",next)).
  4. 4. Save and recalculate: Confirm the formula, press F9 to recalculate, and save the workbook. The recursive output should no longer return #N/A.
Fix #N/A and mismatched array errors in recursive LAMBDA and LET formulasFull compatibility with .xlsx and .xlsm files from Microsoft ExcelUse familiar Excel formula syntax without changing your existing functionsFree and lightweight spreadsheet editor for Windows, macOS, Android, and iOS
microsoft office alternative - wps office

Frequently Asked Questions

Why does recursive LAMBDA return #N/A when VSTACK processes the result?

When a LET variable such as next starts as a scalar, then becomes an array in later recursion, VSTACK receives arrays with different row counts. The IF branches return differently shaped results, so WPS Spreadsheets or Excel cannot align them and returns #N/A.

How can I check whether a LET variable is scalar or array before stacking?

Use a shape test inside the formula, for example =IF(ISERROR(CONCAT(next)),"xx",VSTACK("xx",next)). This forces a consistent branch when next is scalar and only performs VSTACK when the value is safe to stack.

Where can I edit a LAMBDA formula in WPS Spreadsheets?

Go to the Formulas tab, click Name Manager, select the LAMBDA name, and click Edit. You can update the formula directly in the Name Manager dialog.

Does WPS Spreadsheets support LET, LAMBDA, and VSTACK functions?

Yes. WPS Spreadsheets supports these dynamic array functions and can open Microsoft Excel workbooks that use them, so you can edit and fix formula errors without changing file format.