Summary

This example shows how to calculate a volunteer hour requirement. The requirement is to have 15 volunteer hours, with at least 5 in each category. The formula in F6 is:

=AND(COUNTIF(C6:E6,">=5")=3,SUM(C6:E6)>=15)

Generic formula

=AND(COUNTIF(rng,">=5")=3,SUM(rng)>=15)

Explanation 

In this example, the goal create a formula that will return TRUE when a volunteer has successfully logged the required number of hours in each of the three categories. Two requirements must be satisfied:

  1. A volunteer should have at least 5 hours in each of the three categories.
  2. A volunteer needs to have at least 15 hours in total.

Both requirements are evaluated inside a single AND function in a formula like this:

=AND(COUNTIF(C6:E6,">=5")=3,SUM(C6:E6)>=15)

The first requirement is at least 5 volunteer hours in each of the 3 categories: A, B, and C. This requirement is tested with a logical statement based on the COUNTIF function:

COUNTIF(C6:E6,">=5")=3

In the range C6:E6, we count numbers greater than or equal to 5. We need a result of 3 for this requirement to be satisfied, so we compare the result from COUNTIF to 3 directly. The result will be TRUE or FALSE.

The second requirement is to have at least 15 volunteer hours in total. This requirement is tested with a simple logical expression based on the SUM function:

SUM(C6:E6)>=15)

Here, we use SUM to add up all ours in the range C6:C15 then we compare the result to the number 15 with the greater than or equal to operator (>=). As long as the sum is at least 15, this expression will return TRUE.

Finally the results from the two expressions above are evaluated by the AND function. If both the logical expressions return TRUE, the AND function will return TRUE. If either expression returns FALSE, AND will return FALSE.

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.