Sum Based on Multiple Criteria

kumara_faith

Well-known Member
Joined
Aug 19, 2006
Messages
922
Office Version
  1. 365
Hi,

I have the following raw data from an AS400 system:

Raw Data in Sheet 1
1602257417096.png


Each of the process type is categorized as follows:

Table 1 In Sheet 2
1602257465687.png


The above category does not exist in the raw data.

Would it be possible to summarize the raw data in a summary table in sheet 3 by referencing the raw data in sheet 1 to the category in sheet 2 ?

Summary Table in Sheet 3
1602257578029.png
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Here are a couple of ways, depending on which version of Excel you have:

Dynamic functions.xlsm
ABCDEFGHI
1Process TypePagesProcess TypeCategory TypeTotal Pages
2FGTY10FGTYForeignForeign3939
3FGTR10FGTRForeignTransfer4040
4FDEW9FDEWForeignYield3131
5FRWS10FRWSForeign
6TREW10TREWTransfer
7TGVB10TGVBTransfer
8TRFS10TRFSTransfer
9TYHJ10TYHJTransfer
10YTBB11YTBBYield
11YUIO10YUIOYield
12YHNM10YHNMYield
Sheet5
Cell Formulas
RangeFormula
H2:H4H2=SUMPRODUCT($B$2:$B$12,--(COUNTIFS($D$2:$D$12,$A$2:$A$12,$E$2:$E$12,G2)>0))
I2:I4I2=SUM(SUMIF($A$2:$A$12,IF($E$2:$E$12=G2,$D$2:$D$12,"xxxx"),$B$2:$B$12))
Press CTRL+SHIFT+ENTER to enter array formulas.


If you have Excel 365 with the new array functions, this also should work:

=SUM(SUMIF($A$2:$A$12,FILTER($D$2:$D$12,$E$2:$E$12=G2),$B$2:$B$12))
 
Upvote 0
That worked.
I wonder which one you used and whether or not the last suggestion was applicable for you?

I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Another Excel 365 option if you have the new array functions is ..

20 10 10.xlsm
ABCDEFGH
1Process TypePagesProcess TypeCategory TypeTotal Pages
2FGTY10FGTYForeignForeign39
3FGTR10FGTRForeignTransfer40
4FDEW9FDEWForeignYield31
5FRWS10FRWSForeign
6TREW10TREWTransfer
7TGVB10TGVBTransfer
8TRFS10TRFSTransfer
9TYHJ10TYHJTransfer
10YTBB11YTBBYield
11YUIO10YUIOYield
12YHNM10YHNMYield
Sum
Cell Formulas
RangeFormula
H2:H4H2=SUM(FILTER(B$2:B$12,VLOOKUP(A$2:A$12,D$2:E$12,2,0)=G2,0))
 
Upvote 0
Hi Peter,

Thank you for your feedback. I have updated my account details. Yes, I am using Excel 365 and the last suggestion worked for me.
 
Upvote 0
Thanks for the additional information - & for updating your profile. (y)
 
Upvote 0

Forum statistics

Threads
1,214,518
Messages
6,119,985
Members
448,935
Latest member
ijat

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