The simplest way to solve this problem is with the COUNTIFS function.

COUNTIFS function

TheCOUNTIFS functionreturns the count of cells that meet one or more criteria.

COUNTIFS can be used with criteria based on dates, numbers, text, and other conditions.

Count items in list with two criteria

COUNTIFS supportslogical operators(>,<,<>,=) andwildcards(*,?)

As the formula is copied down, it returns a count for each value in B5:B16.

Note this formula uses thefull column referenceB:B for convenience.

Count items in list with two criteria

With two criteria

In the workbook below, we have Color and Price.

Notice these counts differ from the original example above because some of the same colors have different prices.

COUNTIF can be used to count cells that…

Count items in list with two criteria

Count items in list with two criteria

Count items in list with two criteria

Excel formula: Summary count with COUNTIF

Excel formula: Running count of occurrence in list

Excel formula: Calculate running total

Excel formula: Count cells that contain specific text

Excel formula: Count occurrences in entire workbook

Excel COUNTIFS function

Count items in list with two criteria