Looping to add values based on +/- that correspond to a date

B-radK

Board Regular
Joined
Apr 1, 2010
Messages
96
Office Version
  1. 365
Platform
  1. Windows
Hello team.

I have a range that has a date column and a value column. Next to the dates, there are values with either a positive or a negative value.

The range in columns A to D can be dynamic, i.e. the total number of rows can differ from month to month.

The columns will not change position, they will stay the same.

I would like to loop through the range and sum the numbers with positive values for a specific date and paste them in the corresponding date row, under the positive column.

Similarly, I would like to loop through the range and sum the numbers with negative values for a specific date and paste them in the corresponding date row, under the negative column.

Please see the before and after shots below of what I would like to achieve.

I'm still in the throws of a VBA course and I know how to loop through ranges and select data I need. However, what is outlined above and what I would like to achieve, is well beyond me at this stage.

Any help would be greatly appreciated.

Thanks
Brad.

Image 1.jpg


Image 2.jpg
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
You can do this with a formula, no VBA needed.
In H2 copied down
=Sumifs(D:D,D:D,">0",C:C,G1)
and in I2 copied down
=Sumifs(D:D,D:D,"<0",C:C,G1)
 
Upvote 0
Thanks Fluff.

That's annoying. I've been toying with trying to loop for well over a week now. I have sumifs and sumif on my monthly budget spreadsheet, summing based on criteria, such as "supermarket", "entertainment", "alcohol", etc. ...The same spreadsheet I've been running for about 3 years now.

Once again, thanks Fluff, you're always on point.

I'm off to get a scotch... ?
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,465
Messages
6,124,973
Members
449,200
Latest member
Jamil ahmed

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