Sum upwards by a number of rows

Peter1973

Well-known Member
Joined
May 13, 2006
Messages
957
I am trying to work out how to look in a cell and then look up to the top of the sheet in than column how many cells have the same value and sum the corresponding cells next to them data example below

ABC
1WEST3
2EAST2
3WEST4
4WEST2
5WEST1
6EAST5
7WESTTOTAL10

<colgroup><col width="64" span="4" style="width:48pt"> </colgroup><tbody>
</tbody>

The answer would be 10 in this case as all the cells in A that = A7 the sum of the cells in B=10.
I can do this with a sumif but the location of the cells moves and there is more than 1 sum in the data but i need to to look upwards in all cells above and a sumif gives me a circular reference.

Any help appreciated
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
You could use OFFSET but it's volatile:


Book1
ABC
1WEST3
2EAST2
3WEST4
4WEST2
5WEST1
6EAST5
7WESTTOTAL10
Sheet1
Cell Formulas
RangeFormula
C7=SUMIF(OFFSET($A$1,0,0,ROW()-1),$A7,OFFSET($B$1,0,0,ROW()-1,1))


WBD
 
Upvote 0
Heres another couple of ways:

=SUMIFS($B$1:INDEX(B:B,ROWS($A$1:A7)-1,0),$A$1:INDEX(A:A,ROWS($A$1:A7)-1,0),A7)
=SUMIFS(INDIRECT("$B$1:B"&ROWS($A$1:A7)-1),INDIRECT("A1:A"&ROWS($A$1:A7)-1),A7)
 
Upvote 0

Forum statistics

Threads
1,216,495
Messages
6,130,979
Members
449,611
Latest member
Bushra

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