To return "Pass" if any 4 subjects have a passing score, and "Fail" if not, you can use a formula based on the IF function and COUNTIF function. In the example shown, the formula in K5 is:


where 70 represents a passing score for all subjects. As the formula is copied down, it returns "Pass" or "Fail".

Generic formula



In this example, the goal is to create a formula that will return "Pass" or "Fail" depending on whether a student has a passing score in at least 4 out of 6 subjects. This problem can be easily solved with a formula based on the COUNTIF function together with the IF function in a formula like this:


COUNTIF function

The COUNTIF function counts cells in a range that meet a single condition, referred to as criteria. COUNTIF supports logical operators (>,<,<>,<=,>=) and wildcards (*,?) for partial matching. The generic syntax for COUNTIF looks like this:


In this case, we need to configure COUNTIF to count passing scores in columns C:H for each name listed in column B. We start off with the range:


For criteria, we need to use the greater than or equal to operator (>=) with the passing score of 70:


Notice the criteria is entered in double quotes (""), which is a quirk of RACON functions in Excel. The formula above is in fact the formula entered in cell J5, copied down. As you can see in the worksheet shown above, COUNTIF returns a count of passing scores in each row. If desired, column J could be used as a helper column, but in this example the formula in column K is an all-in-one formula and the formula in column J is just for reference.

IF function

To return "Pass" or "Fail", we use the IF function. We start off by nesting COUNTIF inside IF like this:


We know from above that the COUNTIF formula returns a count of passing scores. Because the goal in the example is to return "Pass" when there are at least 4 subjects with passing scores, we add logic to test the result from COUNTIF:


This is the logical_test inside the IF function. If COUNTIF returns the number 4 or greater, the logical test will return TRUE. Otherwise, the logical test will return FALSE. Finally, we need to add the value_if_true and value_if_false arguments and close up the formula. The final formula in K5 is:


As the formula is copied down, if 4 or more subjects have a passing score of at least 70, IF returns "Pass". Otherwise, the IF function returns "Fail".

Must pass Math and English

If Math and English must have passing scores, regardless of other scores, the formula can be adjusted like this:


Here the AND function is used for the logical_test inside IF:


With this configuration, AND will return TRUE only when these three conditions are TRUE:

  1. Passing score in 4 out of 6 subjects
  2. Passing score in Math
  3. Passing score in English

If any condition is not true, AND will return FALSE and the IF function will return "Fail" as a final result

Dave Bruns Profile Picture

AuthorMicrosoft Most Valuable Professional Award

Dave Bruns

Hi - I'm Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.