Cellwise Try it free

Excel guide · 4 min read

How to count Yes and No answers in Excel

Quick answerUse =COUNTIF(C2:C11,"Yes") to count the Yes answers and =COUNTIF(C2:C11,"No") for the No answers. COUNTIF ignores case, so "yes" and "YES" are counted too. For a checkbox or TRUE/FALSE column, use =COUNTIF(D2:D11,TRUE) without quotes.

Sample data

Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.

ABCD
1AttendeeTeamWould recommend?Joined online
2Priya NairSalesYesTRUE
3Tom BeckerSupportNoFALSE
4Ana SouzaSalesYesTRUE
5Liam WalshFinanceFALSE
6Mei ChenSupportyesTRUE
7Jonas BergSalesNoFALSE
8Grace OkaforFinanceYes TRUE
9Owen PriceSupportYesTRUE
10Sara LindSalesNoFALSE
11Dev PatelFinanceYesTRUE

Download this sheet as an Excel practice file (.xlsx)

Count Yes and No with COUNTIF

Ten people answered a post-workshop survey. Column C holds their answer to "Would you recommend it?". COUNTIF takes the range to check and the value to count, and the value goes in quotes because it is text.

COUNTIF is not case-sensitive, so Mei Chen's lowercase "yes" counts. Liam Walsh skipped the question, so his cell is empty and is in neither count.

=COUNTIF(C2:C11,"Yes")

Result: 5

5. Swap "Yes" for "No" and you get 3. That is 8 answers from 9 non-empty cells, so one answer is missing from both counts (see the stray-space section).

Percent who said Yes

Decide what you are dividing by before you build the formula. "Percent of everyone surveyed" divides by all ten people. "Percent of people who answered" divides by the Yes plus No count, which is what most survey reports mean, because a skipped question is not a No.

Format the cell as a percentage (Home > Number > %). Avoid COUNTA(C2:C11) as the divisor: it counts any non-empty cell, including typos, "N/A" and cells that only hold a space.

=COUNTIF(C2:C11,"Yes")/(COUNTIF(C2:C11,"Yes")+COUNTIF(C2:C11,"No"))

Result: 0.625 shows as 63% with Percent format

0.625, so 62.5% of the people who gave a Yes or No said Yes. A 0% format rounds it to 63%.

Stray spaces: the answer COUNTIF misses

Grace Okafor's cell in C8 holds "Yes " with a space at the end. It looks identical on screen, but COUNTIF compares the whole text, so it is neither "Yes" nor "No". This is very common in form exports and in cells someone typed by hand.

You can catch it with a wildcard, =COUNTIF(C2:C11,"Yes*"), which also returns 6 here, but that also counts answers such as "Yes, if it were shorter". A safer check trims every cell before comparing. SUMPRODUCT handles the whole range and works in every version of Excel.

=SUMPRODUCT(--(TRIM(C2:C11)="Yes"))

Result: 6

6: the five clean Yes answers plus Grace's "Yes ". The -- turns each TRUE or FALSE into 1 or 0 so SUMPRODUCT can add them.

Count Yes per team with COUNTIFS

COUNTIFS takes pairs of range and value, and a row is counted only when every pair matches. Put the team names down a column of a summary table and point the formula at that cell instead of typing "Support", so one formula fills the whole table.

The trailing-space problem applies here too. Finance has two Yes answers on screen, but COUNTIFS finds only one because of C8. Clean the data once (see below) rather than patching every formula.

=COUNTIFS(B2:B11,"Support",C2:C11,"Yes")

Result: 2

2: Mei Chen and Owen Price. Tom Becker, the third Support attendee, said No.

Checkboxes and TRUE/FALSE columns

A checkbox in Microsoft 365 (Insert > Checkbox) stores TRUE when ticked and FALSE when not, and older form controls can be linked to a cell that does the same. Count them with TRUE or FALSE as the criteria, with no quotes.

Do not try to SUM a TRUE/FALSE column: SUM ignores logical values in a range, so =SUM(D2:D11) returns 0 here. If you want to add them, convert them to numbers first with =SUMPRODUCT(--D2:D11), which returns 6.

=COUNTIF(D2:D11,TRUE)

Result: 6

6 people joined online. =COUNTIF(D2:D11,FALSE) gives the other 4.

Stop the problem at the source: a Yes/No drop-down

Every variant you have to catch ("Y", "yes ", "Yes!") comes from free typing. A drop-down list leaves only two possible values, so a plain COUNTIF stays correct. To fix the cells you already have, use Home > Find & Select > Replace, or a TRIM helper column pasted back as values.

  1. Select C2:C11.
  2. Go to Data > Data Validation.
  3. Under Allow, choose List.
  4. In Source, type Yes,No and click OK.
  5. Each cell now shows a drop-down arrow, and typing anything else is rejected.

Common mistakes

Yes cells that look right but are not counted

They hold a leading or trailing space, or a different character such as a non-breaking space from a web form. Use SUMPRODUCT(--(TRIM(range)="Yes")) to check, then clean the column.

Using COUNTA as the "answered" total

COUNTA counts every non-empty cell, including typos and cells with only a space. Divide by COUNTIF "Yes" plus COUNTIF "No" instead.

Putting TRUE in quotes for a checkbox column

Write =COUNTIF(D2:D11,TRUE). TRUE without quotes is the logical value a checkbox stores, which is what you are counting.

Counting "not Yes" as No

=COUNTIF(C2:C11,"<>Yes") returns 5 here, because it also counts the blank answer and the "Yes " with a space. Count "No" directly.

FAQ

How do I count the number of Yes in Excel?

Use =COUNTIF(range,"Yes"), for example =COUNTIF(C2:C11,"Yes"). It counts every cell that says Yes in any mix of upper and lower case.

How do I calculate the percentage of Yes answers in Excel?

Divide the Yes count by the number of answers: =COUNTIF(C2:C11,"Yes")/(COUNTIF(C2:C11,"Yes")+COUNTIF(C2:C11,"No")), then format the cell as a percentage. Divide by the total number of people instead if blanks should count against the result.

Why is my COUNTIF for "Yes" too low?

Some cells probably contain spaces or a slightly different word. Compare =COUNTIF(C2:C11,"Yes") with =SUMPRODUCT(--(TRIM(C2:C11)="Yes")); if the second is higher, there are spaces to clean.

How do I count ticked checkboxes in Excel?

A ticked checkbox stores TRUE in its cell, so =COUNTIF(D2:D11,TRUE) counts the ticked ones and =COUNTIF(D2:D11,FALSE) the unticked ones.

Functions used

Related guides

Updated