SUMPRODUCT problem

lmcwrod

New Member
Joined
Jul 13, 2006
Messages
41
Hope somebody can help with the following SUMPRODUCT problem. I have a formula that I want to copy across many cells in a row. The sumproduct formula will match the values in the 2 cells above (criteria 1, criteria 2) with values in a database. However, for some cells, I don't care what value is in criteria 2 (only criteria 1 is relevant for certain cells in this row). Thus, I want it to be able to use a wildcard and have the SUMPRODUCT incorporate the values regardless of what appears for criteria 2 in the database. I am trying to put a '*' in the criteria 2 cell for the cells where I don't care what the criteria 2 value is and have SUMPRODUCT read this wildcard but it's not working out.

Hope the snipit below helps clarify:
PMG_MarketShares_AD_5.xls
AZBABBBCBD
2Column1Column2Column3Column4
3Criteria1ABCD
4Criteria2345ANYVALUE
5Rowshowingsumproductvalues#REF!#REF!#REF!#REF!
MaxPumpCapacity
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Try:

=IF(BA4="ANYVALUE",COUNTIF(database.xls!A1:A200,BA3),SUMPRODUCT(--(databasefile.xls!A1:A200=BA3),--(databasefile.xls!B1:B200=BA4)))

Note: you can replace "ANYVALUE" in the formula with a null, "" if you want to actually leave Criteria 2 blank.
 
Upvote 0
Thanks, NBVC. For the purpose of clarity, I think I oversimplified the situation. The SUMPRODUCT formula actually reads 3 criteria. 2 of which are above and 1 of which is the first value in each row. I don't think the COUNTIF will work with 2 criteria.

Do you think there is a way to do this with more 2 criteria that must be matched but 1 criteria that matters for some cells but not for all?
 
Upvote 0
Building on the Countif problem, I can simply put an if with 2 sumproduct formulas:
=IF(criteria2=0,sumproduct1,sumproduct2)
 
Upvote 0

Forum statistics

Threads
1,213,562
Messages
6,114,322
Members
448,564
Latest member
ED38

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