How to Count Students with 'Yes' in Either of Two Excel Columns
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'.

- 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.
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.
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.
Click on an empty cell where you want the final student count to be displayed.
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.
Press Enter. The formula will automatically parse through the entire array and output the total number of students with at least one 'Yes'.

Use a Helper Column with OR Function (Older Excel Versions)
A highly compatible method that uses an additional column to evaluate each row individually before summing the totals. Perfect for older spreadsheet environments.
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. Open your data file: Launch WPS Spreadsheet and open the document containing your student records.
- 2. Select your output cell: Click on the specific cell where you want the final tally to appear.
- 3. Enter the formula: Input =SUMPRODUCT(--((E2:E100="Yes")+(F2:F100="Yes")>0)) or use the BYROW formula if utilizing the latest updates.
- 4. View the count: Press Enter to instantly view your unique student count. The logical formula evaluates the data immediately.

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")).




