For convenience, the D5:D15 isnamedcolor.

TheCOUNTIFS functionwill allow multiple conditions, but all conditions are joined with AND logic.

The article below explains several options.

Excel formula: Count cells that contain specific text

However,criteriais “red” in the first COUNTIF and “blue” in the second.

The first COUNTIF returns 4 and the second COUNTIF returns 3, so the final result is 7.

This formula works fine, but it is somewhat redundant.

Excel formula: COUNTIFS with multiple criteria and OR logic

These counts are returned directly to theSUM functionin a singlearray:

And SUM returns 7 as the result.

In other words, COUNTIF returns multiple counts to SUM, and SUM returns a final result.

This is an example ofnestingone formula inside another.

Excel formula: Count cells equal to one of many things

Inside SUMPRODUCT there are two expressions joined by the addition (+)operator.

In the second array, the TRUE values correspond to cells that contain “blue”.

Double-counting risk

When counting with OR logic, be aware of the risk of double-counting.

Excel formula: Range contains one of many values

These values can be numbers, cell references, ranges, arrays, and constants, in any combination.

SUM can handle up to 255 individual arguments.

SUMPRODUCT Function

The Excel SUMPRODUCT function multipliesrangesorarraystogether and returns the sum of products.

Excel formula: SUMPRODUCT count multiple OR criteria

Excel COUNTIF function

Excel SUM function

Excel SUMPRODUCT function