How to Count “Yes” and “No” Responses in Excel Using COUNTIF: A Step-by-Step Tutorial


Counting specific occurrences within a dataset is a fundamental requirement of modern data analysis, especially when managing survey results, evaluating quality control checks, or dealing with Boolean values or categorical responses like “Yes” and “No.” Whether you are tracking project completion statuses, monitoring audit responses, or simply evaluating pass/fail rates in a large population, the ability to rapidly and accurately quantify these mutually exclusive outcomes is essential for informed decision-making.


Microsoft Excel provides robust, built-in functionality designed to handle this type of conditional counting with exceptional efficiency. Rather than resorting to time-consuming manual tallies or complex array formulas, we can rely entirely on the powerful and versatile COUNTIF function. This guide will demonstrate precisely how to leverage COUNTIF to extract accurate counts and percentages for binary responses within any specified data range, transforming raw data into meaningful statistical summaries.

Understanding the COUNTIF Function in Excel

The COUNTIF function is the cornerstone of conditional counting in Excel. Its primary purpose is straightforward: to count the total number of cells within a specified range that successfully meet a single, predefined criterion. This capability makes it indispensable for isolating and quantifying specific responses, such as the binary outcomes of “Yes” or “No,” from a larger pool of data. By automating this tally process, analysts eliminate the risk of human error inherent in manual counting, especially when dealing with high-volume datasets.


The function requires only two primary arguments to execute its task efficiently. First, the range defines the contiguous block of cells (a column or row) that you intend to evaluate. Second, the criteria specifies the condition that a cell must meet to be included in the final count. This criteria could be a text string (like “Yes”), a number, a date, or even a logical expression (like “>50”). When working with text criteria, it is essential to enclose the text in quotation marks (e.g., “No”) so that Excel correctly interprets it as a literal string to match.


The syntax for the COUNTIF function is intuitive and easy to implement: =COUNTIF(range, criteria). For instance, if your responses are located in cells B2 through B21, the range would be specified as B2:B21. This precision allows Excel to accurately differentiate between various text strings and numerical values, ensuring that only the exact, specified matches contribute to the final tally. The reliability and simplicity of COUNTIF make it the ideal starting point for analyzing categorical data in your spreadsheet.

Core Formulas for Counting Specific Binary Values

Before we can calculate proportional statistics, we must first establish the absolute counts for both the positive (“Yes”) and negative (“No”) responses within our dataset. These two fundamental formulas represent the most basic and direct application of conditional counting in Excel, providing the raw, unqualified numbers of affirmative and negative entries found within your selected data range. We will use the hypothetical range B2:B21 for demonstration purposes throughout this section.

Formula 1: Count Number of “Yes” Values


This formula systematically scans every cell in the designated range (B2:B21) and increments the count only when it encounters the exact text string “Yes.” This calculation is crucial for determining the total count of positive affirmations, successful outcomes, or confirmed statuses within the analyzed sample.

=COUNTIF(B2:B21, "Yes")

Formula 2: Count Number of “No” Values


Conversely, this formula performs the exact same operation but targets the text string “No.” It counts every cell within the range that contains this negative response. This calculation is vital for determining the total count of negative entries, failures, or non-confirmations within the dataset, providing the counter-statistic necessary for a complete binary analysis.

=COUNTIF(B2:B21, "No")

Calculating Proportions: Combining COUNTIF and COUNTA

While raw counts (e.g., 9 “Yes” responses) are informative, they often lack context without knowing the total sample size. Professional analysts nearly always require the relative proportion, or percentage, of these values compared to the total number of records. To calculate accurate percentages in Excel, we must structure the formula as a division operation, where the conditional count (obtained via COUNTIF) is divided by the total number of entries in the range.


For determining the total population size (the denominator in our division), we utilize the highly effective COUNTA function. The COUNTA function is designed to count all cells within a specified range that are not empty. This provides a robust and accurate measure of the sample size, regardless of whether the cells contain text strings (like “Yes” or “No”), numbers, or logical values. This ensures that every valid response, whether affirmative or negative, contributes to the total population count, leading to accurate proportional calculations.


By structuring the formula to first count the desired criterion (numerator) and then divide it by the total non-empty cells (denominator), we effectively convert the raw counts into meaningful proportions. Once calculated, these results can be easily formatted as percentages within Excel, providing instant insight into the distribution of your data.

Method 3: Count Percentage of “Yes” Values


This powerful combined formula calculates the exact percentage of cells that contain “Yes” by dividing the absolute number of “Yes” counts by the total number of records present in the range B2:B21.

=COUNTIF(B2:B21, "Yes")/COUNTA(B2:B21)

Method 4: Count Percentage of “No” Values


Similarly, this method determines the proportional distribution of “No” responses. It divides the number of “No” counts obtained via COUNTIF by the total number of non-empty records, providing the overall failure or negative rate within the specified data range.

=COUNTIF(B2:B21, "No")/COUNTA(B2:B21)

Practical Application: Analyzing Student Pass/Fail Data

To solidify the understanding of these functions, let us apply them to a practical, real-world scenario often encountered in educational data analysis: determining the success rate of students in an academic course. Our sample data records whether various students achieved a passing grade (“Yes”) or a failing grade (“No”) for a course, with the results compiled in the range B2:B21.


The following illustration visually represents the structure of this sample data. It contains twenty distinct entries, providing a clear foundation for our conditional counting exercise. This data set, based entirely on Boolean values, perfectly demonstrates the utility of the COUNTIF function in quickly summarizing binary outcomes.


Our objective is now to process this raw data to derive both the absolute counts (number of passes/fails) and the percentage metrics (pass rate/fail rate). By calculating these metrics, we can rapidly ascertain the overall student performance for the class and gain crucial insights into the distribution of success and failure within the cohort.

Example: How to Count “Yes” and “No” Values in Excel

Using the four core formulas defined in the previous sections, we can now input these calculations into specific summary cells (E1 through E4). Placing the summarized results outside the primary data range allows for clearer interpretation and presentation. We are specifically targeting the pass/fail data located in the range B2:B21.

  • E1: Calculates the total absolute count of students who passed (“Yes”). Formula: =COUNTIF(B2:B21, “Yes”)
  • E2: Calculates the total absolute count of students who failed (“No”). Formula: =COUNTIF(B2:B21, “No”)
  • E3: Calculates the percentage of the total student population who passed. Formula: =COUNTIF(B2:B21, “Yes”)/COUNTA(B2:B21)
  • E4: Calculates the percentage of the total student population who failed. Formula: =COUNTIF(B2:B21, “No”)/COUNTA(B2:B21)

Executing these four formulas provides a comprehensive and succinct summary of the pass/fail distribution for the class. The following screenshot meticulously illustrates the implementation of these functions in the designated summary cells, showcasing the resulting counts and percentages instantly derived from the raw data.

Excel count Yes and No values

Interpreting the Results and Using COUNTA

By reviewing the output generated by the COUNTIF function and the combined COUNTIF/COUNTA function, we can immediately extract several important, actionable conclusions regarding the student performance data presented in column B:

  • The absolute count of students who passed the course is 9, derived from the total “Yes” values in the column.
  • The absolute count of students who did not pass is 11, representing the total “No” values found.
  • The overall passing rate is 45% (9/20), indicating the proportion of successful outcomes.
  • The overall failing rate is 55% (11/20), indicating the proportion of negative outcomes.

It is critical to reiterate the precise and necessary role of the COUNTA function in these proportional calculations. As previously noted, COUNTA counts all cells in the range that are not empty, thereby accurately representing the true sample size. If an analyst mistakenly used the standard COUNT function instead, the result would be inaccurate, as COUNT is designed only to tally cells containing numerical data. Since “Yes” and “No” are text strings, COUNT would return zero, leading to an incorrect denominator and flawed percentage calculation.

By utilizing the COUNTIF function as the numerator (representing the successful counts) and the COUNTA function as the denominator (representing the total non-empty records), we execute a highly effective and standard technique in quantitative data analysis within Excel. This combination guarantees the accurate calculation of percentages for any set of categorical or binary data.

Additional Resources

The following tutorials explain how to perform other common operations and advanced conditional calculations in Excel:

Cite this article

Mohammed looti (2025). How to Count “Yes” and “No” Responses in Excel Using COUNTIF: A Step-by-Step Tutorial. PSYCHOLOGICAL STATISTICS. Retrieved from https://statistics.arabpsychology.com/excel-count-number-of-yes-and-no-values-in-range/

Mohammed looti. "How to Count “Yes” and “No” Responses in Excel Using COUNTIF: A Step-by-Step Tutorial." PSYCHOLOGICAL STATISTICS, 10 Nov. 2025, https://statistics.arabpsychology.com/excel-count-number-of-yes-and-no-values-in-range/.

Mohammed looti. "How to Count “Yes” and “No” Responses in Excel Using COUNTIF: A Step-by-Step Tutorial." PSYCHOLOGICAL STATISTICS, 2025. https://statistics.arabpsychology.com/excel-count-number-of-yes-and-no-values-in-range/.

Mohammed looti (2025) 'How to Count “Yes” and “No” Responses in Excel Using COUNTIF: A Step-by-Step Tutorial', PSYCHOLOGICAL STATISTICS. Available at: https://statistics.arabpsychology.com/excel-count-number-of-yes-and-no-values-in-range/.

[1] Mohammed looti, "How to Count “Yes” and “No” Responses in Excel Using COUNTIF: A Step-by-Step Tutorial," PSYCHOLOGICAL STATISTICS, vol. X, no. Y, ص Z-Z, November, 2025.

Mohammed looti. How to Count “Yes” and “No” Responses in Excel Using COUNTIF: A Step-by-Step Tutorial. PSYCHOLOGICAL STATISTICS. 2025;vol(issue):pages.

Download Post (.PDF)
Scroll to Top