Note- going to troubleshoot this code this evening, still having some errors moving down the list of values. Not currently workable, just don't want to reformat my code lines. Feel free to play around. I will add comments and instructions at the same time.
Someone mentioned that this could be done with VBA. I like VBA, so I took a whack at it.
A couple of assumptions:
1 - The time stamp and date are not contained in the same cell (ie 12:00:00 AM | 7/21/2014 NOT 7/21/2014 00:00:00)
2 - You want all of the counts of time stamps grouped within a single listing of days (ie only show one set of Sunday through Saturday, and not create a new set of columns for each additional day - if we started on a Friday, we wouldn't start the grouping on Friday, and if we end on a Tuesday two weeks later, we wouldn't have 16 columns of groupings)
3 - There are no null cells in your data from the first row to the last.
4 - Your timestamps and datestamps data has headers
You should press alt+f11, and open the workbook where you have the data and the source worksheets, and enter this code. Then press F5.
Public Sub PrintDateGroups()
Dim icontrol As Integer
Dim iweeknum As Integer
Dim ipasscount As Integer
Dim lngwalktimevalues As Long
Dim ipasstimecount As Integer
icontrol = 1
Do Until icontrol = -1:
If ThisWorkbook.Sheets("Data").Cells(icontrol,2).Value = "" Then
icontrol = -1
Else
icontrol = icontrol + 1
iweeknum = Weekday(ThisWorkbook.Sheets("Data").Cells(icontrol, 1).Value, vbSunday)
For lngwalktimevalues = 0 To 99999999 Step 694444.4375
If (TimeValue(Format(ThisWorkbook.Sheets("Data").Cells(icontrol, 2).Value, "hh:mm:ss")) * 100000000) <= lngwalktimevalues Then
If iweeknum = 1 Then
If ThisWorkbook.Sheets("Destination").Cells(Round((lngwalktimevalues / 694444.4375) + 1, 0), 2).Value <> "" Then
ThisWorkbook.Sheets("Destination").Cells(Round((lngwalktimevalues / 694444.4375) + 1, 0), 2).Value = ThisWorkbook.Sheets("Destination").Cells(lngwalktimevalues / 694444.4375, 2).Value + 1
Exit For
Else
ThisWorkbook.Sheets("Destination").Cells(Round((lngwalktimevalues / 694444.4375) + 1, 0), 2).Value = 1
Exit For
End If
Else
If ThisWorkbook.Sheets("Destination").Cells((lngwalktimevalues / 694444.4375) + 1, ((3 * iweeknum) + (iweeknum - 2))).Value = "" Then
ThisWorkbook.Sheets("Destination").Cells((lngwalktimevalues / 694444.4375) + 1, ((3 * iweeknum) + (iweeknum - 2))).Value = 1
Exit For
Else
ThisWorkbook.Sheets("Destination").Cells((lngwalktimevalues / 694444.4375) + 1, ((3 * iweeknum) + (iweeknum - 2))).Value = ThisWorkbook.Sheets("Destination").Cells(lngwalktimevalues / 694444.4375, ((3 * iweeknum) + (iweeknum - 2))).Value + 1
Exit For
End If
End If
End If
Next lngwalktimevalues
End If
Loop
End Sub