excel - return time since last occurrence of a string for certain days of the week only -
i working on scheduling sheet. want calculate distance in weeks since person last scheduled on 1 of 3 different 'jobs'. want @ time since last scheduled on weekend, , individuals may scheduled on weekdays intervening between last weekends.
for example:
date day_of_week task_a task_b task_c distance_a distance_b distance_c 7/1/2015 wednesday ed mary amy 0 0 0 7/2/2015 thursday bill judy bob 0 0 0 7/3/2015 friday ed mary amy 0 0 0 7/4/2015 saturday ed mary amy 0 0 0 7/5/2015 sunday ed mary amy 0 0 0 7/6/2015 monday bill mary bob 0 0 0 7/7/2015 tuesday ed judy amy 0 0 0 7/8/2015 wednesday ed amy bob 0 0 0 7/9/2015 thursday bob ed judy 0 0 0 7/10/2015 friday ed bob judy 0 0 0 7/11/2015 saturday ed bob judy 7 0 0 7/12/2015 sunday ed bob amy 7 0 7
gives correct distances each of 3 tasks labels cells first followed new line of data @ each date.
for distance have attempted:
{=if(and(b3="saturday", (a3-max(if($c$2:e2=c3, $a$2:a2, 0)))/7 <53), (a3-max(if($c$2:e2=c3, $a$2:a2, 0)))/7, ".")}
which returns value on each saturday (as intended), cannot scan past recent weekday assignment, giving falsely low values. have attempted other if(or) & if(and)
statements first failure generates false value ceasing program.
any assistance code , formatting example .csv or tab seperated values appreciated.
ok recap need calculate distance in weeks current date date of previous job scheduled @ weekend. conditions are:-
current date must fall on weekend previous date must on weekend previous date must not on same weekend current date must same person.
i've found easier use weekday function check if dates fall on weekend, putting get:-
=if(weekday($a3,16)>=3,"", if(max($a$2:$a2*(c$2:c2=c3)*(weekday($a$2:$a2,16)<3)*(($a3-$a$2:$a2)>1))=0,"", int(($a3-max($a$2:$a2*(c$2:c2=c3)*(weekday($a$2:$a2,16)<3)*(($a3-$a$2:$a2)>1))+1)/7) ) )
to entered array formula in row 3 using ctrl shift enter
i think general logic of formula ok, or , and functions don't work in array formulas have replaced ands multiplications.
at moment checks person appearing in same column post version if needs check across 3 columns.
Comments
Post a Comment