Grouping together data from specific months with VBA

cguy3000

New Member
Joined
May 30, 2019
Messages
15
So this problem might be a bit complicated and I have been trying to concieve of ways to orchestrate a solution to this issue and have come up blank.

Essentially, every week on Monday my branch managers report a specific number to me. It can be realistically any number. And its given a time stamp of when the number is filed. For example,

02/03/19 4
xx/xx/xx 2
xx/xx/xx 3
xx/xx/xx 0


Now I have these data points listing every week till 2015, so yeah lots of data. The issue is I am tryin to create a macro that checks for all the data stamped within a specific month and then summing all that data together into a seperate cell. Currently I am doing this by hand and I just want a way to automate it. I dont want it adding the data together until an entire month has passed so if I click the macro button, if a full new month hasnt passed then it does nothing. However, if a full month has passed then it sums up the data points from that month and sums them into a new cell. I would just create a macro that sums the last four data points and click it at the begining of every month except some months of the year have 5ish weeks in them and it screws with the 4 point system so I am at an impasse.

The desired result would yield data that looks like this, taken from the individual weeks reported above.

4/19 13
5/19 14
6/19 21



and the new month would go at the bottom of this above column with the new summed data and time stamp.

This is beyond my excel skills so any help would be greatly appreciated! Thank you!
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hello. No need for a macro to do this; you can do it with a standard Excel formula.

Assuming your dates are in column A, while your numbers are in column B, you can use a formula such as:

Rich (BB code):
= SUMIFS( B:B, A:A, ">=" & DATE( 2015, 1, 1 ), A:A, "<=" & DATE( 2015, 1, 31 ) )

The formula above will sum all the numbers corresponding to dates in January 2015. You can adapt the formula to work with different months, or even reference cells that contain the start/end dates of each month.
 
Upvote 0
BEAUTIFUL!!! This worked perfectly for what I was trying to accomplish! I can now add it into the system I am coding! Thank you!
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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