Function Problems

How to Count Students with 'Yes' in Either of Two Excel Columns

Adam DavisAdam Davis Nov 10, 2026 870 views

Question details

The user needs to count the number of students who have 'Yes' recorded in at least one of two specific columns, ensuring each student is only counted once even if both columns contain 'Yes'.

How to Count Students with 'Yes' in Either of Two Excel Columns
Product
Excel
Device & OS
not provided
Scenario
Tracking student participation, attendance, or task completion across two separate units or activities where a single 'Yes' qualifies the student.
Observed behavior
Evaluating two cells row-by-row and summing the resulting TRUE or FALSE logical values to yield a unique student count.
Before you start

Ensure your data range is continuous and note the exact column letters (e.g., Columns E and F) containing the 'Yes' values. Clear any empty rows or irrelevant text within your dataset to avoid formula calculation errors.

Solution 1Recommended

Use BYROW and LAMBDA Functions (Newer Excel Versions)

A clean, single-cell formula approach that evaluates both columns simultaneously without needing extra helper columns.

This modern array formula dynamically assesses multiple columns row by row. It guarantees that combinations like Yes/blank, blank/Yes, and Yes/Yes all return exactly one count per student.

1
Select the destination cell

Click on an empty cell where you want the final student count to be displayed.

2
Input the array formula

Type the formula: =SUM(BYROW(E2:F100,LAMBDA(row,--OR(row="Yes")))). Adjust the range E2:F100 to perfectly match the rows and columns containing your student data.

3
Calculate the result

Press Enter. The formula will automatically parse through the entire array and output the total number of students with at least one 'Yes'.

Use BYROW and LAMBDA Functions (Newer Excel Versions)
Efficient Calculation: Using the double negative (--) converts the TRUE/FALSE results of the OR function into 1s and 0s, making it mathematically possible for the SUM function to tally the final count.
WPS Spreadsheet

Easily Count and Analyze Student Data with WPS Spreadsheet

WPS Spreadsheet fully supports advanced array formulas, logical functions, and helper columns. It provides a seamless experience for tracking student data, attendance, and performing complex logical counts without performance lag.

  1. 1. Open your data file: Launch WPS Spreadsheet and open the document containing your student records.
  2. 2. Select your output cell: Click on the specific cell where you want the final tally to appear.
  3. 3. Enter the formula: Input =SUMPRODUCT(--((E2:E100="Yes")+(F2:F100="Yes")>0)) or use the BYROW formula if utilizing the latest updates.
  4. 4. View the count: Press Enter to instantly view your unique student count. The logical formula evaluates the data immediately.
Fully compatible with Microsoft Excel formulas and .xlsx files.Supports advanced logical functions like OR, SUMPRODUCT, and array operations.Lightweight software with an intuitive, tabbed interface.Free to use for everyday data analysis and student tracking.
microsoft office alternative - wps office

Frequently Asked Questions

Why does COUNTIFS return the wrong number for 'Yes' in either column?

COUNTIFS uses strict 'AND' logic across different range criteria, meaning it only counts rows where BOTH columns are 'Yes'. To use 'OR' logic, you must use array formulas, SUMPRODUCT, or the helper column method.

How do I make the formula ignore text case (e.g., 'yes' vs 'Yes')?

Standard formulas like OR(E2="Yes") in Excel and WPS Spreadsheet are naturally case-insensitive. Text like 'yes', 'YES', and 'Yes' will all be evaluated as TRUE and counted correctly.

Can I use SUMPRODUCT instead of BYROW?

Yes. The formula =SUMPRODUCT(--((E2:E100="Yes")+(F2:F100="Yes")>0)) acts as a great single-cell alternative. It adds the TRUE logicals, evaluates if the sum is greater than 0, and totals the arrays perfectly without needing the BYROW function.

What if I have three or more columns to check?

You can simply expand the range in the BYROW formula (e.g., E2:H100) or add additional cell references to your OR helper column formula (e.g., OR(E2="Yes", F2="Yes", G2="Yes")).