VBA to sort data from multiple worksheets and compile into a worksheet (all same workbook)

ShadowySin

New Member
Joined
Apr 1, 2018
Messages
2
Hi, I need help to create a macro using vba to sort out data. There are many worksheets containing date&time values and for each worksheet, I have to sort out the data. Those with identical date&time values are classified as dual and those with only one date&time value are classified as single. I need to count how many single, how many dual and total number of single and dual for each day. The thing is that I need to code it such that when I set my date parameters such as 1st feb 2018 to 28th feb 2018, only the dates that are inside my data get selected. As you can see from below, the first example is what my data looks like on one worksheet while the other example is what I want to achieve on my analysis worksheet. Basically, the id is my worksheet name and (01-Feb 2018 12:00) is a dual while (01-Feb 2018 13:30) is a single, with 03-Feb not appearing in my analysis because it is not inside the data even though it is within my search parameters.
For example, on A1, 01-feb, there are 2 singles and 1 dual for a total of 3 which means that average is 4/3=1.33

date
01-Feb 2018 12:00
01-Feb 2018 12:00
01-Feb 2018 13:30
01-Feb 2018 14:00
02-Feb 2018 08:00
02-Feb 2018 08:00
08-Feb 2018 07:00
worksheet A1

Search parameters: 01-Feb 2018 to 28-Feb 2018

ID DATE TOTAL DUAL SIN AVG
A1 01-Feb 03 01 02 1.33
A1 02-Feb 19 10 09 1.53
A1 08-Feb 19 09 10 1.47
A1 15-Feb 30 24 06 1.80
A1 18-Feb 25 16 09 1.64
A1 21-Feb 17 12 05 1.71
A2 04-Feb 15 09 06 1.60
A2 08-Feb 18 12 06 1.67
A2 19-Feb 26 20 06 1.77
A2 20-Feb 19 17 02 1.90
A2 21-Feb 40 38 02 1.95
A3 12-Feb 34 32 02 1.94
worksheet analysis

I got the above data by doing it manually which was super troublesome and time consuming so i was wondering if you guys could help me. Thank you
 

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.

Forum statistics

Threads
1,224,820
Messages
6,181,159
Members
453,021
Latest member
Justyna P

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