Order is not important, the two colors can appear anywhere in the cell.
However, both colors must appear in the same cell.
This problem can be solved with theSUMIFS function, which is designed to sum numbers based on multiple criteria.
The syntax for the SUMIFS function depends on the number of conditions needed.
Each separate condition will require arangeandcriteria.
This means both criteria will be applied to the same range, the text in B5:B16.
The asterisk (*) is awildcardavailable in the SUMIFS function which means “zero or more characters”.
We use a wildcard in this case to match “red” occurringanywherein the text.
Notice we are applying twodifferent criteriato thesame range, B5:B15.
In other words, both “red” and “blue” must exist in the text.
Note that SUMIFS isnotcase-sensitive.
Other combinations
The other color combinations in the worksheet shown use the same pattern.