Excel VBA Total number of charges on a bank statement without counting blanks

wafflesncoke

New Member
Joined
Nov 15, 2021
Messages
14
Office Version
  1. 365
Platform
  1. Windows
So I get sent a large file that includes bank statement charges. The charges show as date/merchant/amount due to formatting of when they are copied from one system into excel prior to being sent there are "Blanks" listed under amount. The merchant name duplicates on the blank amount rows so a countif i cannot get to work because it counts the duplicated merchant names. I need to count the number of charges from a specific merchant for a certain dollar amount per day. The merchant name and amount and days all change from file to file. I would normally do this by setting filter manually and selecting to unshow blanks on amount then filter merchant then filter through the days the move on to next merchant etc etc this takes alot of time. Im sure there is a way to write some VBA to count this data for me

I cant post the statement but i can describe the best i can... In excel manually scrolling down without any filters i scroll to cell A312 it has the date is is merged and centered with A312-315 next is the merchant name in cells B312 but that entire row to either side is blank then in cell B313 is the merchant name again(this is the row i need to keep and count the cells mentioned above) in cell B314 is the state B315 is the country. I just need row 313 in this instance row 312 314 315 are essentially blank excluding the merge and center and B312 having a merchant name
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
I cant post the statement but i can describe the best i can...

You don't have to post the actual statement, but I think you will need to give us some examples, you can make up/alter the data as you feel needed. The samples you provide should include the before and the after that you would like to see happen.
 
Upvote 0
Something like the following is what I envision thus far as the before data:

Book1
ABCDEFG
311
31211/15/2021Wells Fargo
313Wells Fargo
314New York
315USA
316
Sheet1


Just need some more info from you.
 
Upvote 0
Book1
A
1Number of Charge
Sheet3

Book1
ABCD
1Number of ChargeDateDollar AmountMerchant
229/1/202115.99Netflix
329/2/202113.99Netflix
Sheet3
 
Upvote 0
Why does that not match the info provided in post #1?
 
Upvote 0
Sorry new to this minisheet thing. Try this again. This should be the data that i get for the transactions at first
Book1
ABCD
1DateMerchantTransactionAmount
2M/D/YName/LocationType
39/1/2021NetflixPurchase15.99
4Netlifx
5State
6Country
79/2/2021NetflixPurchase13.99
8Netlifx
9State
10Country
119/1/2021NetflixPurchase15.99
12Netlifx
13State
14Country
159/2/2021NetflixPurchase13.99
16Netlifx
17State
18Country
Sheet1


Then I add filters and select the amount column and uncheck blanks so it looks like this
Book1
ABCD
1DateMerchantTransactionAmount
39/1/2021NetflixPurchase15.99
79/2/2021NetflixPurchase13.99
119/1/2021NetflixPurchase15.99
159/2/2021NetflixPurchase13.99
Sheet2


I then have to go through the list and put it a separate sheet like this
Book1
ABCD
1Number of ChargesDateDollar AmountMerchant
229/1/202115.99Netflix
329/2/202113.99Netflix
Sheet3
 
Upvote 0
Ok I have code to create up to sheet 3. What happens if you added two different charges on the same day to Walmart for different amounts? How would that make sheet3 look?
 
Upvote 0
If there were 2 charges to walmart on the same date for different amounts it would be listed on separate lines on the third sheet.
Book1.xlsx
ABCD
1Number of ChargesDateDollar AmountMerchant
229/1/202115.99Netflix
329/2/202113.99Netflix
419/2/202145.26Walmart
519/2/202131.26Walmart
Sheet3
 
Upvote 0
@wafflesncoke, couple questions for you before I wrap up the code:

1) How do you want the data sorted in sheet3? I am not referring to the column order. I am referring to the order of relevance.
ie. I assume the dates have the highest priority (oldest to newest), after that do you want the merchants sorted alphabetically by dates or the amounts(highest to lowest) by dates or ...?

So I need to know the order of relevance, from highest to lowest, and the sort preference of low to high or high to low for all four.
ie. Dates(low to high / Merchants(low to high) / Amounts(High to low) / last choice can not be set due to the previous three preferences.

2) Are you wanting to retain the second sheet or delete it which would leave just the first sheet and the final result sheet?
 
Upvote 0
The count of how many charges high to low then date high to low then dollar amount high to low merchant order doesn’t matter that much

And if it’s possible to delete sheet 2 that would be perfect
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,588
Members
449,089
Latest member
Motoracer88

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