google spreadsheet - Query based on datetime interval -
i find out driver available during time based on start , end datetime.
i have 2 worksheets.
worksheet1 displayes start , end time of drivers in datetime:
driver | start time | end time ------------------------------------------ driver 1 | 25-05-2015 09:00 | 25-05-2015 15:00 driver 2 | 25-05-2015 15:00 | 25-05-2015 21:00 driver 2 | 26-05-2015 09:00 | 26-05-2015 15:00 driver 1 | 26-05-2015 12:00 | 26-05-2015 17:00
worksheet2 displays start date of tour
tour 1 | 25-05-2015 11:00 tour 2 | 25-05-2015 16:00 tour 3 | 25-05-2015 17:00 tour 4 | 26-05-2015 09:00
i query in worksheet 2 driver worksheet 1 available during time of tour start.
=query(worksheet1!a:c,"select c <= date '"&text(a2,"yyyy-mm-dd")&"'",0)
but understand need working timedate instead (to actual times of start , end of shifts) , need query interval.
if want use dates , times, need datetime
instead of date
. , since there interval, comparison should made column b. query string, shown linebreaks readability, be
"select b <= datetime '" & text(a2, "yyyy-mm-dd hh:mm:ss") & "' , c >= datetime '" & text(a2, "yyyy-mm-dd hh:mm:ss") & "'"
this ensures datetime in a2 between datetimes in columns b , c.
Comments
Post a Comment