The worksheet shown contains two different approaches.

In the range F5:G8, we have created a summary table to summarize counts by color.

The article below explains both approaches.

Excel formula: Sum if cells are equal to

Note: both formulas below usefull column references(e.g.

B:B, C:C).

The solution relies on theSUMIF function.

Excel SUMIF function

the cell above).

If the two values match, we return anempty string("").

Note: this formula depends on data being sorted by group to make it get sensible results.

Excel SUMIFS function

One advantage of the summary table approach is that the sort order doesn’t matter.

However, be aware that full column references can cause severe performance problems in specific circumstances.

Why about Pivot Tables?

Excel IF function

Pivot tablesremain an excellent way togroup and summarize data.

Criteria can be applied to dates, numbers, and text.

More than one condition can be tested by nesting IF functions.