logo
search
Function Problems

How to Count Values by Person in an Excel Matrix

Emma BrownEmma Brown Sep 28, 2026 871 views

Question details

The user wants to count specific text entries (like 'x' and 'c') for each person across multiple weekly columns in a matrix, avoiding the need to manually select individual column ranges.

How to Count Specific Values by Person in an Excel Matrix
Product
Microsoft Excel / WPS Spreadsheet
Device & OS
not provided
Scenario
Summarizing data from a complex matrix where columns are grouped by individuals' names, and specific values need to be counted dynamically.
Observed behavior
Counting values manually requires selecting disjointed columns for each person, which is time-consuming and prone to errors. The user needs an automated formula to handle the cross-referencing.
Before you start

Ensure your spreadsheet software is updated to a version that supports dynamic array functions like BYCOL and LAMBDA. If you are using an older version, you will need to rely on legacy array formulas instead.

Solution 1Recommended

Use a Dynamic Array Formula with BYCOL and LAMBDA

This is the most efficient method for modern spreadsheet versions, allowing you to iterate over columns dynamically and count values based on multiple criteria.

By combining BYCOL and LAMBDA, you can create a custom function that evaluates each column in your matrix individually, checking for both the target person and the required entry.

1
Identify Data Ranges

Locate your matrix data range (e.g., $B$2:$G$8) and ensure your summary table has reference cells for the person's name (e.g., B$11) and the value to count (e.g., $A12).

2
Enter the Formula

Select the first output cell in your summary table and input the formula: =SUM(BYCOL($B$2:$G$8,LAMBDA(c,COUNTIF(c,B$11)*(COUNTIF(c,$A12)))))

3
Apply Across the Matrix

Press Enter to calculate the result. Then, click the bottom-right corner of the cell and drag the fill handle to copy the formula across the rest of your summary table.

Use a Dynamic Array Formula with BYCOL and LAMBDA
Version Compatibility: The BYCOL and LAMBDA functions require Office 365, Excel 2021, or the latest version of WPS Office. Older versions will return a #NAME? error.
Advanced Spreadsheet Tool

Use WPS Spreadsheet to Manage Complex Matrix Formulas

WPS Spreadsheet is a powerful, lightweight tool for data analysis. It fully supports advanced matrix calculations, complex array formulas, and cross-referencing, helping you summarize extensive data effortlessly.

  1. 1. Open your Dataset: Launch WPS Spreadsheet and open the workbook containing your matrix data.
  2. 2. Input the Matrix Formula: Select the target summary cell and enter your array formula (e.g., using SUM and IF logic) to count values dynamically.
  3. 3. Fill the Summary Table: Press Enter and drag the fill handle across your table to instantly calculate all required counts for each person.
Fully compatible with Microsoft Excel formulas and .xlsx file formats.Supports modern array functions for quick and accurate data summarization.Lightweight, fast-loading, and free to use for everyday office tasks.
microsoft office alternative - wps office

Frequently Asked Questions

Why is my BYCOL or LAMBDA formula returning a #NAME? error?

This error typically occurs if you are using a legacy version of Excel or spreadsheet software that does not support dynamic array functions. Try updating your software to the newest version, or use the alternative SUM(IF(...)) array formula.

Can I use COUNTIFS instead of combining COUNTIF with LAMBDA?

The standard COUNTIFS function requires all criteria ranges to be the same size and shape. It cannot natively iterate over a 2D matrix while dynamically comparing headers without the help of helper rows or modern functions like BYCOL.

Does WPS Office support dynamic array formulas?

Yes, the latest versions of WPS Spreadsheet include support for numerous advanced dynamic array formulas. Ensure your WPS Office is updated to the most recent version to utilize functions like BYCOL and LAMBDA.