Sum row on change of account (Excel 365)

henryg

Board Regular
Joined
Oct 23, 2008
Messages
145
Office Version
  1. 365
Platform
  1. Windows
I want to get an accumulating sum of rows in the balance column where, in this case, the account number is the same. For example,

DayAccountDrCrBalance
1100010075? (25)
11000500260? (265)
41150400100
? (300)

<tbody>
</tbody>
51150800600
? (500)

<tbody>
</tbody>
52000100025
? (975)

<tbody>
</tbody>

<tbody>
</tbody>

This must be an old chesnut, but I can't work it out.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Assuming your data is sorted by account, you can simply test that:

=IF(B2=B1,E1+D2-C2,D2-C2)

assuming your posted data is in columns A:E with E being the formula column.
 
Upvote 0
Hey,

Try this formula in cell E2 (Balance column):
=SUMPRODUCT(($B$2:B2=B2)*($C$2:C2-$D$2:D2))
And drag that down the E column (Assuming that B is your Account number and C & D are Dr and Cr respectively.
 
Upvote 0
You can also try the below formula in E2 and drag down :

=SUMIF($B$2:B2,B2,$C$2:C2)-SUMIF($B$2:B2,B2,$D$2:D2)
 
Upvote 0
Many thanks, I'll give them a go.

The sumif looks similar to what I tried inc locked start ranges, although I always use sumifs these days even if only one crireria, but I always ended up with a nil value. I wonder if there was some corruption or I just messed up (latter probable ;)). I also played with sumproduct, but not above way.

Thanks again.
 
Last edited:
Upvote 0
Later...sumif/s works and as expected. I am sure sumproduct will work too but I find I understand sumif/s formula quicker when I look back later.

I am bemused why I failed yesterday.
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,581
Members
449,174
Latest member
chandan4057

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