Forum Discussion
LouiseWard29
Mar 04, 2025Copper Contributor
How to count if there is a yes in either of 2 columns
I'm a newbie at Excel and don't even know how to frame this question properly, so forgive me! I have a spreadsheet of students enrolled in various classes. There is a separate column for each unit...
- Mar 04, 2025
If the data are in adjacent columns, for example E2:F100:
=SUM(BYROW(E2:F100, LAMBDA(r, --OR(r="Yes"))))
Alternatively, create a helper column, for example in column Z: if the data are in E2:E100 and G2:G100, enter
=--OR(E2="Yes", G2="Yes")
in Z2, and fill down to Z100. You can then use =SUM(Z2:Z100) for the count.
HansVogelaar
Mar 04, 2025MVP
If the data are in adjacent columns, for example E2:F100:
=SUM(BYROW(E2:F100, LAMBDA(r, --OR(r="Yes"))))
Alternatively, create a helper column, for example in column Z: if the data are in E2:E100 and G2:G100, enter
=--OR(E2="Yes", G2="Yes")
in Z2, and fill down to Z100. You can then use =SUM(Z2:Z100) for the count.
LouiseWard29
Mar 10, 2025Copper Contributor
Thank you so much, was able to cut and paste that formula and adjust my variables for a win!