Counting Yes and No in Excel: Step-by-Step Guide
In this article
Use COUNTIF to count yes and no values in Excel: =COUNTIF(A2:A100,"Yes") counts the yes answers and =COUNTIF(A2:A100,"No") counts the no answers. For a combined yes-plus-no total, either add the two results or use =COUNTIF(A2:A100,"Yes")+COUNTIF(A2:A100,"No"). That is the whole job. Everything below is the detail that keeps the counts correct when your data is messy.
COUNTIF looks at one range, compares each cell against your text or criteria, and returns how many cells matched. It is case-insensitive, so "yes", "Yes" and "YES" all count together. It matches whole cell contents rather than fragments, so a cell containing "Yes, definitely" is not counted as Yes unless you add wildcards. The function is the same in Excel for Windows, Excel for Mac, Excel for the web, and the mobile apps, though the way you enter it differs.
A quick accuracy note before you start: Excel only counts text or numbers actually present in the cells. A cell that looks empty but contains a space, a stray apostrophe, or an invisible character will not match "Yes" or "No" and will silently fall out of your total. That is the most frequent cause of totals that do not add up.
What You'll Need
- A spreadsheet with a column of yes/no answers, ideally with a header in the first row
- The desktop Excel app (Windows or Mac) for the easiest experience, or Excel for the web and the mobile apps if you have them
- A blank cell where the result can go, so the formula does not overwrite your data
- A few seconds to check your answer column for inconsistent entries before counting
Step-by-Step
- Find the range you want to count. Look at where your answers actually start and stop. If the answers are in column B and the header "Response" is in B1, with data down to B87, your range is B2:B87. Write the range on a sticky note or in a scratch cell before typing the formula. Do not use whole columns like B:B if your sheet has other text anywhere in that column, because COUNTIF will count those too.
- Click the cell where you want the yes count. Pick a cell outside the data, such as D2, and label it first if you like: type Yes in D1. Labels make the finished summary readable and stop you mixing up which number is which.
- Type the COUNTIF formula. Enter
=COUNTIF(B2:B87,"Yes")and press Enter. Function names and the bracket structure are not case-sensitive. The text criteria must be in double quotes, and those quotes are straight ASCII quotes, not smart quotes. On a Mac, if smart quotes are on, Excel may reject the formula; retype the quotes manually if you see an error. - Repeat for No. In the next cell down, enter
=COUNTIF(B2:B87,"No"). You can also drag the first formula down one row and edit Yes to No, which is faster than retyping the range. - Choose your result cells in one go. Select an empty cell, click the small function icon beside the formula bar, search for COUNTIF in the dialog, and fill in Range and Criteria. This is the most reliable route on Excel for the web and in the mobile apps, where typing formulas on a phone keyboard is error-prone. On mobile, the app inserts the function for you and you only fill in the two boxes.
- Check the numbers against your data. If you have 70 answers and your yes count is 42 while your no count is 25, three answers are being missed. Sort the answer column (Data tab, sort A to Z) and look at the cells sitting on their own. They will usually be blanks, spaces, "Y", "N", "Maybe", or trailing spaces. Fix them at the source rather than adjusting the formula.
- Add the two counts together if you need a total. Either enter
=D2+E2referencing the two result cells, or combine into one formula:=COUNTIF(B2:B87,"Yes")+COUNTIF(B2:B87,"No"). Adding the result cells is easier to audit because you can see both components. - Count percentages, not just totals. For the share of yes answers, enter
=COUNTIF(B2:B87,"Yes")/COUNTA(B2:B87)and format the cell as a percentage with the % button on the Home tab. COUNTA counts all non-empty cells in the range, which is usually what you want as the denominator. If you want the share of answered cells only, use the sum of your yes and no counts as the divisor instead. - Make it permanent and reusable. If you will refresh the data regularly, turn the range into a table (select the data, then Insert > Table) and point your formulas at the table column. The formulas then extend automatically as rows are added. Alternatively, use Named Ranges so the formula reads
=COUNTIF(Answers,"Yes"), which is far easier to check later. - Put the counts on a visible summary block. Bold the labels, add a border, and leave the formula cells unlocked if other people will enter data. A small summary block at the top or side of the sheet makes the workbook self-explanatory without anyone opening a formula.
If your answers are in a different case or with leading or trailing spaces, wrap the criteria in wildcards or clean the data. Text that arrives from a web form or a copy-paste from email often carries a trailing space, so "Yes " is not equal to "Yes" as far as COUNTIF is concerned. The safest fix is a helper column: =TRIM(CLEAN(B2)) copied down, then count the helper column. That removes extra spaces and invisible characters in one pass.
Common Mistakes
The most common error is leaving out the quotes around the criteria. =COUNTIF(B2:B87,Yes) returns a #NAME? error because Excel reads Yes as a function or named range, not text. Always wrap text criteria in double quotes.
Second is a range that is too narrow or too wide. If you typed B2:B50 but the data runs to row 87, you lose 37 answers silently with no error message. Always confirm the last row with Ctrl+Down (Windows) or Command+Down (Mac) before committing the formula.
Third is counting a column that contains both your data and a total row. A total row with the word Total in the answer column will not match Yes or No, so it does no harm, but a summary sheet pasted below the data will wreck the range. Keep summary blocks well clear of the data column.
Fourth is confusing COUNTIF with COUNTIFS. COUNTIF takes one range and one criterion. COUNTIFS takes pairs and is used when you need yes answers in one column combined with a region or date in another. If you add more than two arguments to COUNTIF, you will get a #VALUE! or wrong-argument error.
Fifth is expecting a count of blank cells to appear in the total. It will not. If you need to count blanks so the three numbers reconcile, use =COUNTBLANK(B2:B87) and compare.
Tips
Use the wildcard criteria "*Yes*" when answers contain extra words such as "Yes, but later". The asterisk matches any text before and after, so the count picks up the answer wherever it appears. Be cautious, though: the same wildcard would also count "Yes and no" as a yes, so only use it when the answers are genuinely free text.
To count answers that are not strictly yes or no but should be treated as one, such as "Y" and "Yes", add a second term: =COUNTIF(B2:B87,"Yes")+COUNTIF(B2:B87,"Y"). If the list grows beyond a couple of alternatives, a table of accepted answers and a SUM of COUNTIFs beats a huge nested formula.
If your yes/no values are tick boxes rather than text, they behave as TRUE and FALSE. Count them with =COUNTIF(B2:B87,TRUE) for the checked ones and use COUNTBLANK or a FALSE criterion for the rest, depending on how the checkbox was made. Check a cell's actual value by clicking it and looking at the formula bar before writing the count formula.
Keep your raw data on its own sheet and build the summary on a separate sheet. It keeps the counts away from accidental edits, and you can then reference the range with the sheet name, such as =COUNTIF(Data!B2:B87,"Yes").
Troubleshooting
The formula returns zero but you can see yes answers. Check for trailing spaces in the answer cells, check that the criteria quotes are straight, and confirm the range is the right column. A quick test is to select two neighbouring answer cells and press Ctrl+Backslash or use Go To Special > Row differences to see what differs. Another fast test is to type =B2="Yes" in an empty cell and see whether it returns TRUE or FALSE. If it returns FALSE, the text is not what it looks like.
You get #NAME? or #VALUE!. A #NAME? error almost always means missing quotes around the criteria or a mistyped function name. #VALUE! usually means an extra argument or a missing bracket. Delete the formula and retype it slowly, watching the bracket pairing; Excel colour-codes matching brackets as you type.
The count is higher than the number of rows. This happens when the range overheard data above or below, or when a wildcard is matching unintended text. Narrow the range to the exact data block and recheck.
The formula worked yesterday and now shows a different number. Someone has edited the data, added rows, or pasted over the range. Use the trace precedents tool (Formulas tab > Trace Precedents) to see exactly which cells feed the result, and confirm the last row of the data has not moved.
The count does not update on Excel for the web. Refresh the browser tab and recalculate with F9 if your workbook is set to manual calculation. Check File > Options > Formulas and set calculation to automatic if you find manual selected. On the desktop, Ctrl+` shows every formula in the sheet and is a quick way to spot a formula that points at the wrong place.
Frequently Asked Questions
Does COUNTIF count uppercase and lowercase differently?
No. COUNTIF ignores case, so Yes, yes and YES all count together. If you specifically need an exact-case count, use SUMPRODUCT with EXACT instead.
Can I count yes and no in one formula?
Yes. Use =COUNTIF(range,"Yes")+COUNTIF(range,"No"). This is the sum of both answers and is handy for checking how many rows have a valid answer at all.
Why does my COUNTIF miss some yes answers?
Almost always hidden spaces or characters in the cells. Use TRIM and CLEAN in a helper column and count that column instead.
Can I use COUNTIF on multiple sheets at once?
Not directly. Count each sheet separately and add the results, or consolidate the data onto one sheet with copy and paste before counting.
What is the difference between COUNTIF and COUNTIFS?
COUNTIF takes one range and one condition. COUNTIFS takes multiple range and condition pairs and is the right tool when a yes must also fall within a region, a date range, or another column's value.
Will COUNTIF work in Excel on a phone?
Yes. The mobile app supports COUNTIF, and the function-insert dialog is the easiest way to enter it, since typing quotes and ranges on a phone keyboard is fiddly.