I have a google spreadsheet that contains a list of id#s and date/times. For each id#, for each date, Id like to count the # of entries. For example, id 3496978724, starting in row 2, has 4 entries for 10/1/2013. After we count the # of entries an ID has for the day, the following rules should be applied. If the # of entries is:
1
This should be considered "One Way." All records for that id for the day should be classified as "One Way"
2
If the difference between the two times is less than 2.5 hours, all records for that id for the day should be classified as "One Way"
If the difference between the two times is greater than 2.5 hours, all records for that id for the day should be classified as "Round Trip"
3
If the difference between any two times is more than 2.5 hours apart, all records for that id for the day should be classified as "Round Trip"
Otherwise, all records for that id for the day should be classified as "One Way"
4
If the difference between any two times is more than 2.5 hours apart, all records for that id for the day should be classified as "Round Trip"
Otherwise, all records for that id for the day should be classified as "One Way"
5 or greater
If the difference between any two times is more than 2.5 hours apart, all records for that id for the day should be classified as "Round Trip"
Otherwise, all records for that id for the day should be classified as "One Way"
In the end
Id like a list of each id/date combination, along with whether that corresponding date was roundtrip or one way.
https://docs.google.com/spreadsheet/ccc?key=0Am5eEooQEL63dGc3NksyM3JhRTl0QVQwclAtSXdoUmc&usp=sharing
1: Always output "One Way"
>=2: If the difference of any two times are larger than 2.5 hours, then output "Round Trip", otherwise "One Way"
I assumed you already grouped the student ID together and sort the data in the order of date within the same student ID. In this case, you may try to create a script (Tools -> Script Editor) and add a function like this:
Open in new window
Since I found my timezone is different from the data, so I added a column C to get the date as shown in column B by a formula "=TEXT(B?, "YYYY/MM/DD")" for each row.
A sample is referenced below:
https://docs.google.com/spreadsheet/ccc?key=0AoYcUhd_FqORdEZDLWcwZmVWeUFRVEdQODBsUE52RlE&usp=sharing
Please try. Thanks.