# SUMPRODUCT problem

#### lmcwrod

##### New Member
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:
AZBABBBCBD
2Column1Column2Column3Column4
3Criteria1ABCD
4Criteria2345ANYVALUE
5Rowshowingsumproductvalues#REF!#REF!#REF!#REF!
MaxPumpCapacity

### Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
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.

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?

Building on the Countif problem, I can simply put an if with 2 sumproduct formulas:
=IF(criteria2=0,sumproduct1,sumproduct2)

That is exactly what I was going to say.

Replies
11
Views
310
Replies
2
Views
165
Replies
3
Views
173
Replies
3
Views
237
Replies
5
Views
173

1,220,986
Messages
6,157,224
Members
451,406
Latest member
Kevin_267

### 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?

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