SUMIFS with Cell Reference for Multiple Criteria List

mmuller

New Member
Joined
Oct 15, 2009
Messages
3
I have a series of formulas to calulate values from a table, and there may be one or more criteria for a given criteria range. For instance, there are two criteria listed for the Species range and three for the Product range in the example below:

=SUM(SUMIFS(DataTable[Volume],DataTable[Species],{"Hardwood","Pine"},DataTable[Product],{"Poles*","Sawtimber*","Pulp*"},DataTable[Month],$B$3))

I would like to replace the Species and Product criteria lists each with a single cell reference where the lists are maintained (cells B10 and B11, respectively). In essence, the formula would look something like:

=SUM(SUMIFS(DataTable[Volume],DataTable[Species],B10,DataTable[Product],B11,DataTable[Month],$B$3))


Is it possible to get this to work? I am beginning to have my doubts, but I may have the syntax wrong... Here is my latest attempt that still fails:

Cell B10: "Hardwood","Pine"
Cell B11: "Poles*","Sawtimber*","Pulp*"

=SUM(SUMIFS(DataTable[Volume],DataTable[Species],"{"&B10&"}",DataTable[Product],"{"&B11&"}",DataTable[Month],$B$3))


Cheers!
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hi,

Why in a single cell, if you don't mind me asking? It's possible, but messy, since effectively you would have to perform string extractions on the cell value.

Why not just in separate cells, which is straightforward?

Regards
 
Upvote 0
Welcome to the board.

First:
=SUM(SUMIFS(DataTable[Volume],DataTable[Species],{"Hardwood","Pine"},DataTable[Product],{"Poles*","Sawtimber*","Pulp*"},DataTable[Month],$B$3))
That doesn't work quite the way you think it does.
You should look closely at the data and compare the math in your head vs the result of the formula.

If you have 2 sets of multiple criteria, this syntax doesn't work as you would think
You have to transpose 1 of the sets of criteria, useing ; instead of , in the {}
So it should be

=SUM(SUMIFS(DataTable[Volume],DataTable[Species],{"Hardwood";"Pine"},DataTable[Product],{"Poles*","Sawtimber*","Pulp*"},DataTable[Month],$B$3))


2nd: I don't think you can put that criteria string {"..",".."} into a single cell.
However, you can put each criteria into it's own cell, creating lists..
But again, 1 must be transposed.
So 1 range is say A1:A5 (a column) while the other is C2:E2 (a row)
Then you can use

=SUMPRODUCT(SUMIFS(rangetosum,criteria1range,A1:A5,criteria2range,C2:E2))


Hope that helps.
 
Upvote 0
Thanks Jonmo1. I fully agree on the use of the semicolon to get the correct value when there are two sets of multiple criteria.

The truth is that I got a little overzealous with my example, and on my actual worksheet there are no cases that require multiple sets of multiple criteria. In most cases it will simply be one species and one product OR multiple species or multiple products without the other criteria.

Apologies for any confusion!
 
Upvote 0
Care to post a little sample data?

I would love to, but the link to d/l the MrExcel HTML Maker is broken! :( The sample would look something like this with many more records, of course...

SpeciesProductVolumeMonth
HardwoodPulp-Thin54563
HardwoodCNS2537
PineSawtimber89642

<tbody>
</tbody>
 
Upvote 0
ABCD
1SpeciesProductVolumeMonth
2HardwoodPulp-Thin54563
3DbeCNS2537
4PineSawtimber89642
5AbcPulp-Thin993
6HardwoodCNS6587
7PineSawtimber74533
83
9Hardwood, Pine
10Pulp,Sawtimber

<tbody>
</tbody>

Code:
=SUMPRODUCT(--(ISNUMBER(SEARCH(LEFT(B2:B7,4),A10))),--(ISNUMBER(SEARCH(A2:A7,A9))),--(D2:D7=A8),C2:C7)
 
Upvote 0

Forum statistics

Threads
1,215,379
Messages
6,124,607
Members
449,174
Latest member
ExcelfromGermany

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