Originally Posted by
ShadowySin
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