Count the number of hours within a certain range on excel -
Count the number of hours within a certain range on excel -
i wanting enhance functionality of time sheet. want calculate if person's hours falls range, , if so, count how many hours. example:
a user clocks in on time sheet: tuesday: 05:00 - 04:00 i.e. - worked 23 hours.
from above time, want count how many hours have worked between time range 19:30 - 07:30.
manually calculating works out @ 9.5 hours - or 09:30.
many thanks.
this working me in cases i've tested:
data cells:
a1: range start | b1: range end
a2: clock in | b2: clock out
formula:
=if(b2<a1,0,if(a2>b1,0,if(a2<a1,if(b2>b1,b1-a1,b2-a1),if(b2>b1,b1-a2,b2-a2)))) the result in days, if want in hours, multiply 24.
=if(b2<a1,0,if(a2>b1,0,if(a2<a1,if(b2>b1,b1-a1,b2-a1),if(b2>b1,b1-a2,b2-a2))))*24 if times span more 1 day, it's crucial work cells include date. in excel, if come in time, (fake) date 00/01/1900, ending times have appropriate date, specified next day: 01/01/1900. therefore, if have time, have well.
but if total datetime from, example, database, won't have issue, have modify range cells have corresponding dates, or modify clock cells convert date 00/01/1900, depending on scenario. please give more details if need help this.
excel
Comments
Post a Comment