Sum Multiple Row and Column with Condition

Chang123

New Member
Joined
Jul 7, 2021
Messages
11
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
  3. Web
Hey there, I have two sheets on hand, and need to sum the multiple results in condition at the third sheet. Are there anyone can tell me the formula that can achieve it? Thanks!

Here's what I have:

Sheet 1
1627051973449.png


Sheet 2
1627052045713.png



And here's what I want:

Sheet 3
1627052105412.png
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
If I understood you well, try the formula below on Sheet3
Code:
=SUMPRODUCT((Sheet1!$B$1:$D$1=$A2)*(Sheet1!$A$2:$A$4=B$1)*(Sheet1!$B$2:$D$4))*SUMIFS(Sheet2!$B$2:$B$7,Sheet2!$A$2:$A$7,$A2)
 

Attachments

  • Chang123.png
    Chang123.png
    5.8 KB · Views: 12
Upvote 0
If I understood you well, try the formula below on Sheet3
Code:
=SUMPRODUCT((Sheet1!$B$1:$D$1=$A2)*(Sheet1!$A$2:$A$4=B$1)*(Sheet1!$B$2:$D$4))*SUMIFS(Sheet2!$B$2:$B$7,Sheet2!$A$2:$A$7,$A2)
Thank you navic, and let me make it more clear.

This should be how the Sheet 3 looks like:

1627064413175.png


And with new rows being added to Sheet 2, the amount in Sheet 3 should also be updated accordingly.

Thanks again
 
Upvote 0
And with new rows being added to Sheet 2, the amount in Sheet 3 should also be updated accordingly.
Probably a shorter formula is possible, but here's a quick one (three column headers)
Try
Code:
=SUMPRODUCT((Sheet1!$B$1:$D$1="A")*(Sheet1!$A$2:$A$4=A2)*(Sheet1!$B$2:$D$4))*SUMIFS(Sheet2!$B$2:$B$100,Sheet2!$A$2:$A$100,"A")+SUMPRODUCT((Sheet1!$B$1:$D$1="B")*(Sheet1!$A$2:$A$4=A2)*(Sheet1!$B$2:$D$4))*SUMIFS(Sheet2!$B$2:$B$100,Sheet2!$A$2:$A$100,"B")+SUMPRODUCT((Sheet1!$B$1:$D$1="C")*(Sheet1!$A$2:$A$4=A2)*(Sheet1!$B$2:$D$4))*SUMIFS(Sheet2!$B$2:$B$100,Sheet2!$A$2:$A$100,"C")
 

Attachments

  • Chang123-2.png
    Chang123-2.png
    4.6 KB · Views: 12
Upvote 0
Thank you, and can I ask what the A, B and C here in red mean? because when I copy the formula to my workbook, the results just showing 0s. I don't know where's the issue and I'm not sure if it's about the A, B and C here...

=SUMPRODUCT((Sheet1!$B$1:$D$1="A")*(Sheet1!$A$2:$A$4=A2)*(Sheet1!$B$2:$D$4))*SUMIFS(Sheet2!$B$2:$B$100,Sheet2!$A$2:$A$100,"A")+SUMPRODUCT((Sheet1!$B$1:$D$1="B")*(Sheet1!$A$2:$A$4=A2)*(Sheet1!$B$2:$D$4))*SUMIFS(Sheet2!$B$2:$B$100,Sheet2!$A$2:$A$100,"B")+SUMPRODUCT((Sheet1!$B$1:$D$1="C")*(Sheet1!$A$2:$A$4=A2)*(Sheet1!$B$2:$D$4))*SUMIFS(Sheet2!$B$2:$B$100,Sheet2!$A$2:$A$100,"C")
 
Upvote 0
The A, B and C are your headers on Sheet1 (Row1).

Instead of these letters, you can put the cell address in the formula (like formula below).
Code:
=SUMPRODUCT((Sheet1!$B$1:$D$1=Sheet1!$B$1)*(Sheet1!$A$2:$A$4=A2)*(Sheet1!$B$2:$D$4))*SUMIFS(Sheet2!$B$2:$B$100,Sheet2!$A$2:$A$100,Sheet1!$B$1)+SUMPRODUCT((Sheet1!$B$1:$D$1=Sheet1!$C$1)*(Sheet1!$A$2:$A$4=A2)*(Sheet1!$B$2:$D$4))*SUMIFS(Sheet2!$B$2:$B$100,Sheet2!$A$2:$A$100,Sheet1!$C$1)+SUMPRODUCT((Sheet1!$B$1:$D$1=Sheet1!$D$1)*(Sheet1!$A$2:$A$4=A2)*(Sheet1!$B$2:$D$4))*SUMIFS(Sheet2!$B$2:$B$100,Sheet2!$A$2:$A$100,Sheet1!$D$1)
Note:
- "A" -> Sheet1!$B$1
- "B" -> Sheet1!$C$1
- "C" -> Sheet1!$D$1
 
Upvote 0
The A, B and C are your headers on Sheet1 (Row1).

Instead of these letters, you can put the cell address in the formula (like formula below).
Code:
=SUMPRODUCT((Sheet1!$B$1:$D$1=Sheet1!$B$1)*(Sheet1!$A$2:$A$4=A2)*(Sheet1!$B$2:$D$4))*SUMIFS(Sheet2!$B$2:$B$100,Sheet2!$A$2:$A$100,Sheet1!$B$1)+SUMPRODUCT((Sheet1!$B$1:$D$1=Sheet1!$C$1)*(Sheet1!$A$2:$A$4=A2)*(Sheet1!$B$2:$D$4))*SUMIFS(Sheet2!$B$2:$B$100,Sheet2!$A$2:$A$100,Sheet1!$C$1)+SUMPRODUCT((Sheet1!$B$1:$D$1=Sheet1!$D$1)*(Sheet1!$A$2:$A$4=A2)*(Sheet1!$B$2:$D$4))*SUMIFS(Sheet2!$B$2:$B$100,Sheet2!$A$2:$A$100,Sheet1!$D$1)
Note:
- "A" -> Sheet1!$B$1
- "B" -> Sheet1!$C$1
- "C" -> Sheet1!$D$1
Got it, thanks!
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,174
Members
452,615
Latest member
bogeys2birdies

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