How to Fix BYCOL and BYROW #CALC! Errors in Excel
Question details
The user needs to resolve a #CALC! error caused by nesting BYCOL and BYROW functions while trying to count unique filtered values across row and column combinations.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Evaluating row and column combinations to generate a grid of unique filtered value counts using a single dynamic array formula.
- Observed behavior
- The nested BYCOL and BYROW formula fails and returns a #CALC! error instead of generating the intended result grid.
Verify that your spreadsheet software supports dynamic array functions such as MAP, MAKEARRAY, and LAMBDA, and ensure your source data ranges have compatible dimensions.
Use the MAP Function to Evaluate Combinations
Replace nested BYCOL and BYROW functions with a single MAP function to process each row-and-column combination without triggering a nested array error.
The #CALC! error occurs because Excel's calculation engine currently does not support arrays of arrays, which is what happens when you nest BYCOL inside BYROW. The MAP function avoids this limitation by iterating over an array of concatenated criteria instead.
Click the top-left cell where you want the resulting count grid to appear.
Input the formula using MAP and LAMBDA: =MAP(C3#&B4#,LAMBDA(A,COUNTA(UNIQUE(FILTER(K3:K25,J3:J25&I3:I25=A)))))
Press Enter. The dynamic array will automatically calculate and spill the unique counts across the required rows and columns.

Generate the Result Grid with MAKEARRAY
Use the MAKEARRAY function to programmatically build the result grid based on specific row and column indices.
Handle Complex Array Formulas Easily in WPS Spreadsheet
WPS Office provides robust support for modern dynamic array formulas, making it easy to filter, count, and evaluate complex datasets without running into restrictive calculation errors.
- 1. Install WPS Office: Download and install WPS Office for free from the official website.
- 2. Open your spreadsheet: Launch WPS Spreadsheet and open your existing Excel workbook.
- 3. Enter the array formula: Type your dynamic array formula (such as MAP or FILTER) into the target cell.
- 4. Calculate the results: Press Enter to instantly evaluate the formula and spill your results across the grid.

Frequently Asked Questions
Why do nested BYCOL and BYROW functions return a #CALC! error?
Spreadsheet calculation engines generally do not support arrays of arrays. Nesting functions like BYROW and BYCOL attempts to output an array for every element of another array, resulting in a nested array violation that triggers a #CALC! error.
Can I use SUMPRODUCT to count unique values instead?
While SUMPRODUCT is excellent for counting combinations based on multiple criteria, counting strictly unique values across multiple variables is extremely complex with older formulas. Using the UNIQUE and FILTER functions wrapped in a MAP or MAKEARRAY formula is significantly more efficient and readable.
What should I do if my MAP formula returns a #SPILL! error?
A #SPILL! error occurs when the dynamic array formula does not have enough blank cells to display the full result grid. To fix this, clear any text or data in the cells adjacent to your formula so the results have room to populate.




