Sum cells based on values in a different row

broncosrul

New Member
Joined
May 3, 2012
Messages
25
I am trying to sum a couple ranges based on labels in another row. The reason that I need it to be based on these labels is that the range will change. I have managed to get cell addresses in a very clunky way, but I can't get them to sum. Plus, it seems like there is probably a better way to identify the range. (just now thinking that I may be able to do this with SUMIF). But anyway, here is where I am at.

Row 1 is text and cannot be formatted differently. I was able to get some of the addresses with these formulas. Cell B2 would always be consistant. Basically, I need to sum the 2016 range and the 2017 range.

Code:
=ADDRESS(2,MATCH(TRUE,INDEX(RIGHT(A4:I4,2)="2017",0),0),4,1)
delivered E2

Code:
=ADDRESS(2,MATCH(TRUE,INDEX(A1:R1="",0),0)-2,4,1)
delivered G2

But I don't know how to sum those delivered addresses.
A
B
C
D
E
F
G
H
I
1
Wk
W/E 07/02/2016
W/E 07/09/2016
W/E 07/16/2016
W/E 07/01/2017
W/E 07/08/2017
W/E 07/15/2017
YOY $ Chg
2
Sales
$500
$800
$300
$750
$500
$900
need formula for this cell that would deliver =(sum(E2:G2)-sum
(B2:D2))

<tbody>
</tbody>
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
I was able to get an answer using

Code:
=(SUMPRODUCT(--(RIGHT($A$1:$G$1,4)="2017"),A2:G2)-SUMPRODUCT(--(RIGHT($A$1:$G$1,4)="2016"),A2:G2))

But I would still like some other options or at least figure out how to sum a range using the cell addresses that I extracted.
 
Last edited:
Upvote 0
With your first formula in J2 & your second in K2 try this in L2
=SUM(INDIRECT(J2):INDIRECT(K2))
 
Upvote 0

Forum statistics

Threads
1,215,336
Messages
6,124,332
Members
449,155
Latest member
ravioli44

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