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


New Member
Apr 1, 2018
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

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

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


New Member
Apr 1, 2018
P.S. My links to posts in other forums are in

Forum statistics

Latest member
Goldi paul

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...