I have a monthly timesheet with start, end, break time and holiday. I need to see how many hours per week , but Holiday is an text (OFF) and not sure how to correct the formula.
Example:
Start - Finish - Break = Hours worked
8:30 12:00 0:30 3h /I have used =(finish-start-break)*24
Off Off Off #VALUE!
How it's the simple way to correct this error #VALUE! ?
Thank you in advance.
Related
I'm trying to find out if someone was not working during 'out of hours'.
If Monday to Friday, not between the hours of, 8am to 9pm, then the answer would be "Yes"
If it's a Saturday, not between the hours of, 8am to 5pm, the answer
would be "Yes"
If it's a Sunday, not between the hours of, 9am to 5pm, the answer
would be "Yes".
Otherwise the answer would be "No".
There are 4 columns: 1. Person's Name (A) 2. Date (B) 3. Time (C) 4. Out of Hours (D)
I've copied in the formula below which is working correctly for Monday to Friday, but I'm struggling with the second part of the weekend one.
=IF(OR(WEEKDAY(B2)=1,WEEKDAY(B2)=7),"Yes",IF(AND(C2>=8/24,C2<21/24),"No","Yes"))
If anyone could advise on how to change the formula to work with 'out of hours' for Saturday and Sunday?
It would be greatly appreciated.
Since your WEEKDAY(B2) will be from 1 (Sunday) to 7 (Saturday), you can use CHOOSE to select the Start/End time for your "In-Hours" period:
Start: =Choose(Weekday(B2),9,8,8,8,8,8,8)
End: =Choose(Weekday(B2),17,21,21,21,21,21,17)
So, if HOUR(C2) is >= Start, and HOUR(C2) is < End then you are "In-Hours" ("No"), otherwise you are "Out of Hours" ("Yes")
=IF(AND(HOUR(C2)>=CHOOSE(WEEKDAY(B2),9,8,8,8,8,8,8), HOUR(C2)<CHOOSE(WEEKDAY(B2),17,21,21,21,21,21,17)),"No","Yes")
Of course, I would recommend replacing the CHOOSEs with a pair of VLOOKUPs, and having a hidden sheet where you list the Weekday and the Start/End-of-Hours hours. (Much easier to update if The Boss decides to change the hours!)
=IF(WEEKDAY(B2)=7,IF(OR(C2<TIMEVALUE("8:00"),C2>TIMEVALUE("17:00"))=TRUE,"Yes","No"),IF(WEEKDAY(B2)=1,IF(OR(C2<TIMEVALUE("9:00"),C2>TIMEVALUE("17:00"))=TRUE,"Yes","No"),IF(WEEKDAY(B2)<>1,IF(OR(C2<TIMEVALUE("8:00"),C2>TIMEVALUE("21:00"))=TRUE,"Yes","No"),"No")))
You will have to use nested ifs. Hope above formula will work.
How can I calculate hours worked on a project using specific working hours that aren't the same each day?
So Monday - Friday I work 7 am-7 pm, Saturday 9 am -1 pm and I take Sunday off (lucky me). If i start a project on the 1st March 10 am and finish on the 5th March at 9 am how can I calculate an answer of 27 hours ??
I have two cells date/time start and date/time finish. I have multiple rows to do this to and several time points but this essentially will work the same.
I hope makes sense.
Edit - Solutions tried and opposing results
You will need a helper column with this formula:
=24*(SUMPRODUCT((TEXT(ROW(INDEX(AAA:AAA,$F$1):INDEX(AAA:AAA,$F$2)),"dddd")=A1)*(C1-B1))-IF(TEXT($F$1,"dddd")=A1,MOD($F$1,1)-B1,0)-IF(TEXT($F$2,"dddd")=A1,C1-MOD($F$2,1),0))
Then sum that column.
Here it is in one formula using NETWORKDAYS.INTL
=IF(DATEDIF(F1,F2,"d")>1,NETWORKDAYS.INTL(F1+1,F2-1,"0000011")*12+NETWORKDAYS.INTL(F1+1,F2-1,"1111101")*4,0)+IF(DATEDIF(F1,F2,"d")>0,(MOD(F2,1)-IF(WEEKDAY(F2,2)<6,TIME(7,0,0),TIME(9,0,0)))*24+(IF(WEEKDAY(F1,2)<6,TIME(19,0,0),TIME(13,0,0))-MOD(F1,1))*24,(F2-F1)*24)
In MS Excel sheet I want to calculate the time I work in the day hours i.e. the hours between sunrise and sunset, and any hours after sunset.
An example might be that I start work at 06:00 am and finish at 09:00 pm.
Sunrise is 07:00 am and sunset is 06:30 pm.
The total time worked all day would be 15 hours.
Time worked during the day (between sunrise and sunset) would be 11 hours and 30 minutes.
Time worked at night would be 3 hours and 30 minutes.
Here is my simple solution :)
Just copy and paste the formulas in E5 and F5 and drag them down to calculate the time as per your requirement
Formula in E5 is:
=IF(AND(B5<$C$1;C5>=$G$1);$G$1-$C$1;IF(AND(B5>=$C$1;C5<$G$1);C5-B5;IF(AND(B5<$C$1;C5<$G$1);C5-$C$1;$G$1-B5)))
Formula in F5 is:
=C5-B5-E5
It is important to note that my solution covers all four possibilities which are:
1. Start work at night and end at night
2. Start work at day and end at day
3. Start work at night and end at day
4. Start work at day and end at night
:)
Below is what I think you want to achieve.
Since I have included sunrise and sunset as columns it means that you can add another column Date and then you can track each new day as a new row; since sunrise and sunset change each day you cannot simply have one cell to set the times for these for all your data.
The formulas:
A2
06:00:00
B2
21:00:00
C2
07:00:00
D2
18:30:00
E2
=IF(B2>D2,D2,B2)-IF(A2<C2,C2,A2)
F2
=(B2-A2)-E2
Notice that I have written the times in 24 hour clock.
This is important since Excel cannot tell the difference between 07:00 if it is AM or PM and you cannot pass AM or PM in the cells.
The formula in E2 will check if you have started before sunrise or not. If you have started before sunrise then it will just use the sunrise time.
Then it will do the same check for sunset; using sunset if you have worked after sunset.
After that it will just subtract the two numbers and return the time worked.
F2 will just simply subtract the start and end time to work out total time worked all day and will then just subtract the time worked in the day.
First full disclosure. Excel is new to me. My boss has given me this task. I've tried to search yadda yadda here I am. :)
I have been given the task over SETTING a NEW ETA for milk DELIVERIES. So I've taken all 700 STOPS in our region and COPY and PASTED ARRIVAL TIMES from every STOP over the LAST 50 DAYS.
I am trying to AVERAGE ETA.
Example: Truck arrives between 11:37 pm and 1:30 am over the last 50 days.
Solution:
I have 50 exact delivery times and I need an average time that falls in the 11:37 pm to 1:30 am window.
What I've tried.
AutoSum AVERAGE gives a time of 4:30 pm.
Converting all times to decimals.
Formating Custom and choosing [h]:mm:ss
The only way I seem to get a time anywhere near a valuable ETA is to change to military time and change 0:15 to 24:15, 1:15 to 25:15 etc.
While I could manually enter this in 23,000 cells there has to be an easier way.
HELP! =)
Picture of my spreadsheet
I took a shot at this. As you can see, I formatted columns B2, C2 as time hh:mm:ss AM/PM then I simply used AVERAGE formula in D2 as AVERAGE of B2 and C2
Excel seems to be doing the right thing here and I even used multiple columns
and experimented with some times.
Perhaps all that is needed is to format the cells so that the format represents as time AM/PM.
I have 2 columns with:
Night shift start: 19:00
Night end: 04:00
And I have some date columns with for each day..
Work started: 07:30
Worked ended: 22:00
I want to get the number of hours as a decimal that is between the night shift start and night end. I need to calculate the number of "night shift hours" for worked hours.
From comment: I do not want to get the total number of hours. I want to calculate the number of "night shift hours" and that is hours between 19:00-04:00
=IF(B1-A1 < 0, 1-(A1-B1),( B1-A1))
Assuming that cell A1 contains start, B1 contains end time.
Let me know, if it helps OR errors.
Time without date is not enough to do the subtraction considering the start can be the night before today.
Are you OK to try VBA?
EDIT: The formula is meaningful within 12 hour limit. I will see if it can be made simpler.
Given start time in B5 and end time in C5 this formula will give you the decimal number of hours that fall in the range 19:00 to 04:00
=MOD(C5-B5,1)*24-(C5<B5)*(19-4)-MEDIAN(C5*24,4,19)+MEDIAN(B5*24,4,19)
format result cell as number
just substract the two dates to get the difference in days, and multiply by 24 to get the difference in hours
=(B1-A1)*24
this is correct when both B1 and A1 contain a datetime value, but in case your cells contain just a time value, with no day value, and given that the calculation spans the night (there is a day change in between) you need to add one day to the difference:
=IF(B1<A1,1+B1-A1,B1-A1)*24