Sum Calculation using Reference values from other columns

supernova2008

New Member
Joined
Dec 21, 2018
Messages
3
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD="align: center"]23[/TD]
[TD="align: center"]35[/TD]
[TD="align: center"]2.3[/TD]
[TD="align: center"]4567
[/TD]
[/TR]
[TR]
[TD="align: center"]32[/TD]
[TD="align: center"]23[/TD]
[TD="align: center"]0.5[/TD]
[TD="align: center"]658[/TD]
[/TR]
[TR]
[TD="align: center"]45[/TD]
[TD="align: center"]76[/TD]
[TD="align: center"]-1.7[/TD]
[TD="align: center"]2585[/TD]
[/TR]
[TR]
[TD="align: center"]76[/TD]
[TD="align: center"]45[/TD]
[TD="align: center"]2.5[/TD]
[TD="align: center"]2574[/TD]
[/TR]
[TR]
[TD="align: center"]45[/TD]
[TD="align: center"]27[/TD]
[TD="align: center"]-3.4[/TD]
[TD="align: center"]1573[/TD]
[/TR]
[TR]
[TD="align: center"]34[/TD]
[TD="align: center"]82[/TD]
[TD="align: center"]1.2[/TD]
[TD="align: center"]4793[/TD]
[/TR]
[TR]
[TD="align: center"]95[/TD]
[TD="align: center"]41[/TD]
[TD="align: center"]-3.8[/TD]
[TD="align: center"]2634[/TD]
[/TR]
[TR]
[TD="align: center"]31[/TD]
[TD="align: center"]55[/TD]
[TD="align: center"]-6.1[/TD]
[TD="align: center"]6391[/TD]
[/TR]
[TR]
[TD="align: center"]56[/TD]
[TD="align: center"]58[/TD]
[TD="align: center"]3.9[/TD]
[TD="align: center"]2772[/TD]
[/TR]
</tbody>[/TABLE]

Need to calculate sum of nos. provided in column D (Range for calculation in column D should be from row no. of maximum in column A to row no. of minimum in column B and for corresponding negative values of column C.

please help
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
in this case :
Maximum value in column A = 95
Row no. of maximum value = 8
Minimum value in column B = 23
Row No. of minimum value = 3

So the sum with corresponding negative value between between Row no. 3 to Row no. 8 should be 2585+1573+2634 = 6792
 
Upvote 0
The following formula returns the expected result for the posted dataset:

=SUMPRODUCT(--(ROW(D1:D10)-ROW(D1)+1<=MAX(MATCH(MAX(A1:A10),A1:A10,0),MATCH(MIN(B1:B10),B1:B10,0))),--(ROW(D1:D10)-ROW(D1)+1>=MIN(MATCH(MAX(A1:A10),A1:A10,0),MATCH(MIN(B1:B10),B1:B10,0))),--(C1:C10<0),D1:D10)
 
Upvote 0
The following formula returns the expected result for the posted dataset:

=SUMPRODUCT(--(ROW(D1:D10)-ROW(D1)+1<=MAX(MATCH(MAX(A1:A10),A1:A10,0),MATCH(MIN(B1:B10),B1:B10,0))),--(ROW(D1:D10)-ROW(D1)+1>=MIN(MATCH(MAX(A1:A10),A1:A10,0),MATCH(MIN(B1:B10),B1:B10,0))),--(C1:C10<0),D1:D10)


Range is Dynamic......
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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