How To Add or Sum Up Data For a Given Month (Selected in a Combobox) With VBA Code

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
2,169
Office Version
  1. 2016
Platform
  1. Windows
I will want the summed data to be displayed onto another sheet, sheet2. And should look like this:
TOTAL_FOR_MONTH.jpg


The original data is on sheet1 and looks like this:
New_data_layout.jpg


And here are the logics that I want to apply:
1. Loop through col A for dates that match selected in a combobox (say cb1) on a userform. The cb1 has the months in the form:
JAN, FEB, MAR, etc.
Example, 27-01-21 matches JAN.

2. The next move is to get the totals for each single item within the said month.
* The only challenge here is that various dates might have different listings altogether. That is 26-01-21 might have:

Code:
SALARY        20
KITCHEN      110
RENT            34
CULTURAL    8

While 28-01-21 might have:

Code:
 GENERAL EXPENSE           45
SALARY                              78
CULTURAL                          7
KITCHEN                             39

So let say the month of January has only these two dates in my database, then I want to display on the sheet2 this:

Code:
RENT                                  34
GENERAL EXPENSE            45
SALARY                              98
CULTURAL                         15
KITCHEN                            149

The listing
Code:
RENT                                  
GENERAL EXPENSE            
SALARY                              
CULTURAL                         
KITCHEN
does not have to follow any particular order - as long as it adds up, that is cool.

Please do let me know if you need extra details to get work done.

Thanks in advance.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Cross posted at :

Reason:
I have not received any solution yet.
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,806
Members
449,048
Latest member
greyangel23

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