Formula Errors

How to Fix BYCOL and BYROW #CALC! Errors in Excel

Algirdas JasaitisAlgirdas Jasaitis Nov 11, 2026 869 views

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.

How to Fix BYCOL and BYROW #CALC! Errors in Excel
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.
Before you start

Verify that your spreadsheet software supports dynamic array functions such as MAP, MAKEARRAY, and LAMBDA, and ensure your source data ranges have compatible dimensions.

Solution 1Recommended

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.

1
Select the destination cell

Click the top-left cell where you want the resulting count grid to appear.

2
Enter the MAP formula

Input the formula using MAP and LAMBDA: =MAP(C3#&B4#,LAMBDA(A,COUNTA(UNIQUE(FILTER(K3:K25,J3:J25&I3:I25=A)))))

3
Apply the formula

Press Enter. The dynamic array will automatically calculate and spill the unique counts across the required rows and columns.

Use the MAP Function to Evaluate Combinations
Array Spilling: Make sure there is enough empty space below and to the right of your formula cell to prevent a #SPILL! error.
Advanced Spreadsheet Formulas

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. 1. Install WPS Office: Download and install WPS Office for free from the official website.
  2. 2. Open your spreadsheet: Launch WPS Spreadsheet and open your existing Excel workbook.
  3. 3. Enter the array formula: Type your dynamic array formula (such as MAP or FILTER) into the target cell.
  4. 4. Calculate the results: Press Enter to instantly evaluate the formula and spill your results across the grid.
Fully compatible with Microsoft Excel formulas and .xlsx workbook formats.Built-in support for advanced dynamic array functions and LAMBDA helpers.Lightweight and fast calculation performance, even with large datasets.Free to download with a user-friendly, tabbed interface.
microsoft office alternative - wps office

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.