Sumproduct using wildcard

goldsam120

New Member
Joined
Apr 11, 2018
Messages
2
I am attempting to use sumproduct to total how many times certain abbreviated terms show up in a single column. Sometimes there is only one term, other times there are a string of terms separated by a slash (/) mark. The terms are H, MED, DRUG, ALC, OTC, and UNK. For instance one cell might be only H, but other times it might be H/MED, or even H/MED/ALC. I was interested in using sumproduct, only because I have the data set in a table and I might need to limit my data based on certain years not the entire data set (if that makes sense).

Currently, I have =SUMPRODUCT(SUBTOTAL(3,OFFSET($J:$J,ROW($J:$J)-MIN(ROW($J:$J)),,1))*($J:$J="H")) as the first rule, but it only add H when it is alone. The typical wildcard (* or ?) has not worked for me. I have tried =SUMPRODUCT(SUBTOTAL(3,OFFSET($J:$J,ROW($J:$J)-MIN(ROW($J:$J)),,1))*($J:$J="*/H")) and =SUMPRODUCT(SUBTOTAL(3,OFFSET($J:$J,ROW($J:$J)-MIN(ROW($J:$J)),,1))*($J:$J="H/*")) to sum anytime H shows up, but I have been unsuccessful.

Please consider helping me. Thank you!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
=SUMPRODUCT(--(ISNUMBER(SEARCH("h",J:J))))

This totals the column correctly but when I remove certain years from the table, it still accounts for the full table with all the years. Thank you for the response.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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