COUNTIF and SUMIF with wildcards

thekaoboy

New Member
Joined
Sep 7, 2006
Messages
48
Suppose that I have the following data spread across several columns:

Red, Black
Green, White, Orange
Blue
Green, Orange
Yellow, Blue
Purple, Brown

I wanted to get a count of the number of items that contained the word "Blue", so I used the following formula:

=COUNTIF(G5:H7,"*"&F10&"*")
where G5:H7 contained the values from above and F10 contained the word "Blue".

I also have a column with numeric values, so I am looking to create a similar formula that sums these values based on the same criteria as the COUNTIF. I thought this formula would work:

=SUMIF(G5:H7,"*"&F10&"*",D5:D7)
where D5:D7 contains the numeric values

However, this only returns the first value it finds rather than the sum. I tried setting the formula as an array but I get the same result.

I have a feeling this is a simple one but I just can't figure it out.
Thanks for your help.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,224,518
Messages
6,179,253
Members
452,900
Latest member
LisaGo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top