SUMIFS with multiple criteria in multiple columns

Evripos

New Member
Joined
Mar 3, 2011
Messages
16
Hi all.
I have a rather complicated problem. I have been trying to sum the Weight Column for the following conditions, ID = A or ID = E, ID2 = G11 or ID2 = G4, ID3 = "", and ID4 = "". I have tried many different formulas with SUMIF, SUMIFS, SUBPRODUCT, by using arrays, IF statements and none seems to work. Can someone please help me?

Thank you,
Evripos


<table border="0" cellpadding="0" cellspacing="0" width="320"><col style="width: 48pt;" span="5" width="64"> <tbody><tr style="height: 12.75pt;" height="17"> <td class="xl83" style="height: 12.75pt; width: 48pt;" height="17" width="64">ID</td> <td class="xl83" style="width: 48pt;" width="64">ID2</td> <td class="xl83" style="width: 48pt;" width="64">ID3</td> <td class="xl83" style="width: 48pt;" width="64">ID4</td> <td class="xl83" style="width: 48pt;" width="64">WEIGHT</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">A</td> <td>G1</td> <td>
</td> <td>
</td> <td class="xl81" align="right">0.5</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">A</td> <td>G4</td> <td>
</td> <td>
</td> <td class="xl81" align="right">1.4</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">A</td> <td>G4</td> <td>
</td> <td class="xl82">B</td> <td class="xl81" align="right">1.4</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">A</td> <td>G4</td> <td>
</td> <td>
</td> <td class="xl81" align="right">1.3</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">C</td> <td>G2</td> <td>
</td> <td>
</td> <td class="xl81" align="right">27.5</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">C</td> <td>G5</td> <td class="xl82">A</td> <td>
</td> <td class="xl81" align="right">1.0</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">A</td> <td>G4</td> <td>
</td> <td>
</td> <td class="xl81" align="right">1.4</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">A</td> <td>G4</td> <td>
</td> <td>
</td> <td class="xl81" align="right">1.4</td> </tr> <tr style="height: 12.75pt;" height="17"> <td class="xl82" style="height: 12.75pt;" height="17">E</td> <td>G4</td> <td>
</td> <td class="xl82">B</td> <td class="xl81" align="right">1.3</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">A</td> <td>G4</td> <td class="xl82">A</td> <td>
</td> <td class="xl81" align="right">0.5</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">C</td> <td class="xl82">G3</td> <td>
</td> <td>
</td> <td class="xl81" align="right">27.5</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">C</td> <td>G5</td> <td>
</td> <td>
</td> <td class="xl81" align="right">1.0</td> </tr> <tr style="height: 12.75pt;" height="17"> <td class="xl82" style="height: 12.75pt;" height="17">E</td> <td>G4</td> <td>
</td> <td>
</td> <td class="xl81" align="right">0.2</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">A</td> <td>G4</td> <td>
</td> <td>
</td> <td class="xl81" align="right">0.2</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">A</td> <td>G4</td> <td class="xl82">A</td> <td>
</td> <td class="xl81" align="right">0.2</td> </tr> <tr style="height: 12.75pt;" height="17"> <td class="xl82" style="height: 12.75pt;" height="17">E</td> <td>G1</td> <td>
</td> <td>
</td> <td class="xl81" align="right">25.0</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">A</td> <td>G1</td> <td>
</td> <td>
</td> <td class="xl81" align="right">16.5</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">A</td> <td>G1</td> <td>
</td> <td class="xl82">B</td> <td class="xl81" align="right">2.0</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">A</td> <td>G4</td> <td>
</td> <td>
</td> <td class="xl81" align="right">3.0</td> </tr> </tbody></table>
<table border="0" cellpadding="0" cellspacing="0" width="320"><tbody><tr style="height: 12.75pt;" height="17"><td style="height: 12.75pt;" height="17"><table border="0" cellpadding="0" cellspacing="0" width="320"><tbody><tr style="height: 12.75pt;" height="17"><td class="xl83" style="height: 12.75pt; width: 48pt;" height="17" width="64"></td><td class="xl83" style="width: 48pt;" width="64"></td><td class="xl83" style="width: 48pt;" width="64">
</td> <td class="xl83" style="width: 48pt;" width="64">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td class="xl82">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td class="xl82">
</td> <td>
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td class="xl82" style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td class="xl82">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td class="xl82">
</td> <td>
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td class="xl82">
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td class="xl82" style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td class="xl82">
</td> <td>
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td class="xl82" style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td class="xl82">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> </tr> </tbody></table></td> <td>
</td> <td>
</td> <td>
</td> <td align="right">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> <td align="right">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td class="xl79">
</td> <td align="right">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> <td align="right">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> <td align="right">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td class="xl79">
</td> <td>
</td> <td align="right">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> <td align="right">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> <td align="right">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td class="xl79" style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td class="xl79">
</td> <td align="right">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td class="xl79">
</td> <td>
</td> <td align="right">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td class="xl79">
</td> <td>
</td> <td>
</td> <td align="right">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td><td align="right">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td class="xl79" style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> <td align="right">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> <td align="right">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td class="xl79">
</td> <td>
</td> <td align="right">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td class="xl79" style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> <td align="right">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> <td align="right">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td class="xl79">
</td> <td align="right">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> <td>
</td> <td>
</td> <td>
</td> <td align="right">
</td> </tr> </tbody></table>
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Excel Workbook
ABCDEFGH
1IDID2ID3ID4WEIGHTAE
2AG10.517.025.0
3AG41.4
4AG4B1.4
5AG41.3
6CG227.5
7CG5A1.0
8AG41.4
9AG41.4
10EG4B1.3
11AG4A0.5
12CG327.5
13CG51.0
14EG40.2
15AG40.2
16AG4A0.2
17EG125.0
18AG116.5
19AG1B2.0
20AG43.0
Sheet
 
Upvote 0
Hello, welcome to the board!, Try,

=SUMPRODUCT(--ISNUMBER(MATCH(ID,{"A","E"},0)),--ISNUMBER(MATCH(ID2,{"G4","G11"},0)),--(ID3=""),--(ID4=""),WEIGHT)
 
Upvote 0
First of all let me thank both of you guys for taking the time to help me.
I forgot to mention in my description that it has to be only a single formula and not two. I was able to do it in two but I couldn't combine it into one.
Haseeb I will try your formula as soon as I can and I'll post my results in a new post.

Thank you all again,
Evripos
 
Upvote 0
Haseeb,
Tried your formula, nicely done.
Excel Workbook
ABCDEFG
1IDID2ID3ID4WEIGHT*
2AG1**0.550.9
3AG4**1.4*
4AG4*B1.4*
5AG4**1.3*
6CG2**27.5
7CG5A*1
8AG4**1.4
9AG4**1.4
10EG4*B1.3
11AG4A*0.5
12CG3**27.5
13CG5**1
14EG4**0.2
15AG4**0.2
16AG4A*0.2
17EG1**25
18AG1**16.5
19AG1*B2
20AG4**3*
Sheet


Adjusted the Match data from "G11" to "G1", assumed that was desired, edit if you really wanted G11.
 
Upvote 0

Forum statistics

Threads
1,224,506
Messages
6,179,156
Members
452,892
Latest member
yadavagiri

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