SUMIFS _ more different criteria from same criteria region

aquilla

New Member
Joined
May 12, 2013
Messages
4
Hello

Thing i would like to do in excel is this ..

I have a table with various numbers column and in another column are parameters describing these numbers. I want to sum all numbers which meet the required criteria .. something like this
numbers
parameter
5
B
2
B
5
A
6
D
5
A
3
B
5
A
35
C
33
B
30
C

<tbody>
</tbody>

sum all numbers where parameters are A or C .. in another cell i want to sum all numbers where parameters are A, B, D.

I am not sure, if i am using wrong function or what .. SUMIF and SUMIFS works until I use one criteria like this

a) =SUMIFS(H1:H14; I1:I14; "A")

but when i add another criteria it shows zero

b) =SUMIFS(H1:H14; I1:I14; "A"; I1:I14; "B")

My questions are:
What and how to use to get results a want ?
Is there a way how to add multiple criteria in one criteria range ? When you look on (b) .. its waste of time and space to define criteria range for every new criteria when the range is not changing.

thank you for help and explaining !
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hi and welcome to MrExcel.

Does this work for you?...

Excel Workbook
ABCDE
1NumbersParameterResult
25B64
32B64
45A
56D
65A
73B
85A
935C
1033B
1130C
12
Sheet10


If I'm not mistaken, the SUMIFS will not work as the Parameter can only be "true"/match once, to have multiple criteria, they would have to be in different columns. The Parameter can only ever be A or B or D it cannot be more than one in any single column.

I hope that helps.

Ak
 
Upvote 0
just to shorten it up a little you could try...

=SUMPRODUCT(SUMIFS(A2:A11,B2:B11,{"b","a","d"}))

or

=SUMPRODUCT(SUMIF(B2:B11,{"a","b","d"},A2:A11))
 
Upvote 0
Hi and welcome to MrExcel.

Does this work for you?...

Sheet10

*
A
BCDE
1NumbersParameter*Result*
25B*64*
32B*
64*
45A**
*
56D***
65A***
73B***
85A***
935C***
1033B***
1130C***
12*****

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:62px;"><col style="width:72px;"><col style="width:30px;"><col style="width:64px;"><col style="width:30px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
D2=SUMIF($B$2:$B$11,"A",$A$2:$A$11)+SUMIF($B$2:$B$11,"B",$A$2:$A$11)+SUMIF($B$2:$B$11,"D",$A$2:$A$11)
D3=SUMPRODUCT(--($B$2:$B$11="A")+($B$2:$B$11="B")+($B$2:$B$11="D"),(A2:A11))

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

If I'm not mistaken, the SUMIFS will not work as the Parameter can only be "true"/match once, to have multiple criteria, they would have to be in different columns. The Parameter can only ever be A or B or D it cannot be more than one in any single column.

I hope that helps.

Ak

wow thank you very much for quick reply and welcome :))

It looks that it is working, i appologize i did not mention i am using office 2007,may be thats why i had to substitue "," with ";" in your formula, otherwise i got error message.

guess its solved

thank you again
 
Upvote 0
just to shorten it up a little you could try...

=SUMPRODUCT(SUMIFS(A2:A11,B2:B11,{"b","a","d"}))

or

=SUMPRODUCT(SUMIF(B2:B11,{"a","b","d"},A2:A11))

thank you weazel!! looks neat this way .. i will have to read about sumproduct function, it looks usefull :)
 
Upvote 0
Hi aquilla.

I'm pleased it works for you and thanks for the feedback. :biggrin:

I may be wrong here and I hope that someone corrects me if I am, but I think the use of "," (comma) or ";" (Semicolon) depends on the language of your MS Office pack. I'm using English and I have seen many formulas on here where I have had to change the ";" to a "," for it to work for me.

Ak
 
Upvote 0
=SUM(SUMIF(B2:B11,{"a","b","d"},A2:A11))

will do, unless the criterion values are in a range of their own like

X1: a
X2: b
X3: d

The latter case would require applying control+shift+enter to the current formula or replacing SUM with SUMPRODUCT.
 
Upvote 0
=SUM(SUMIF(B2:B11,{"a","b","d"},A2:A11))

will do, unless the criterion values are in a range of their own like

X1: a
X2: b
X3: d

The latter case would require applying control+shift+enter to the current formula or replacing SUM with SUMPRODUCT.

hmm thank you!! its interesting in how many different ways you can write "same formula" :))
 
Upvote 0

Forum statistics

Threads
1,214,551
Messages
6,120,159
Members
448,948
Latest member
spamiki

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