Macro for merge of .csv files and segegation of currencies when subtotaling

willman32

New Member
Joined
Jun 16, 2011
Messages
9
Hey All,

I was trying to create a macro to merge 4 different .csv files (that change daily) when I reached the roadblock that macros made for files only apply to that specific file.

Say I have 4 files : A,B,C,D (7 columns, different numbers of rows). I want to make a brand new file with the data from each day in descending order :
A
B
C
D

Again, they all have the same number of columns(7 columns), but different number of rows.

Next Question.

Is it possible, to create a macro, after they are merged:
Sort by column C descending
Sort by column G ascending
Sort by column A ascending

Then the problem here now is , to subtotal based on date (column C), but segregate based on currencies(column G , C stands for CDN and U stands for USD).

So a subtotal for C and a subtotal for U for that date (But no subtotal for the TOTAL of that date, just the different currencies on that date).

One last thing, I have no header rows and subtotals start at row 2 for excel, is it possible to include a blank row above the data in the macro then subtotal?

Before Macro:

2vxkhdy.png


After Macro:

setag3.jpg
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Sorry for the double post! But I just wanted to note that the format of column f needs to be to 2 decimal places with a comma separator for the thousands.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,716
Members
452,939
Latest member
WCrawford

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