Formula to sum all the values in a range where the sum of two columns equals a third

ferrethouse2004

New Member
Joined
Dec 3, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I'm conducting capacity planning for a strategic roadmap and for every row in H, I need the sum of all of G where C+D=F (for that particular row). So, for week 9 the capacity returned would be...

3 (7th row) because 4+5 = 9
plus 2 (10th row) because 4+5 = 9
resulting in a value of 5 in H for week 9.

excelquestion.PNG
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Welcome to the MrExcel board!

For the future I suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with. Many people who may otherwise help you will bypass your question if they have to type out all the sample data to test. :)

Is this what you are after? (A couple of options)
If not, please provide (with XL2BB) some more sample data that includes the expected results manually filled in.

23 12 04.xlsm
CDFGHI
31200200
4401200
5402200
6403200
7804300
8805200
9456300
10057000
11258100
12459255
132510100
1441011300
1541012200
1641013300
174101431111
1841515200
1921516200
2001517000
21121518300
2281519200
2322020200
2422021200
2542022200
2682023200
Capacity
Cell Formulas
RangeFormula
H3:H26H3=(C3+D3=F3)*SUMPRODUCT(--(C$3:C3+D$3:D3=F3),G$3:G3)
I3:I26I3=IF(C3+D3=F3,SUM(FILTER(G$3:G3,C$3:C3+D$3:D3=F3)),0)
 
Upvote 0
This worked. Thanks so much.

I actually only needed this part...

SUMPRODUCT(--(C$3:C3+D$3:D3=F3),G$3:G3)
 
Upvote 0
This worked.

I actually only needed this part...

SUMPRODUCT(--(C$3:C3+D$3:D3=F3),G$3:G3)
Those two statements are contradictory since my formula and yours produce different results.
Your formula in col J below.

23 12 04.xlsm
CDFGHIJ
312002000
44012000
54022000
64032000
78043006
88052000
94563000
100570000
112581005
124592555
1325101000
14410113000
15410122002
16410133000
17410143111111
18415152000
19215162000
20015170002
211215183000
22815192002
23220202000
24220212000
25420222004
26820232002
Capacity
Cell Formulas
RangeFormula
H3:H26H3=(C3+D3=F3)*SUMPRODUCT(--(C$3:C3+D$3:D3=F3),G$3:G3)
I3:I26I3=IF(C3+D3=F3,SUM(FILTER(G$3:G3,C$3:C3+D$3:D3=F3)),0)
J3:J26J3=SUMPRODUCT(--(C$3:C3+D$3:D3=F3),G$3:G3)



Perhaps I misunderstood the following requirement?

sum of all of G where C+D=F (for that particular row).
To me, C+D does not meet F in row 7, but I do see how that requirement could be interpreted differently.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,749
Messages
6,180,727
Members
452,995
Latest member
isldboy

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