Microsoft Excel - Split Time into Day & Night - excel

I could really use your help!
A night shift for me begins at 1930 till 2230.
I already have a formula which tells me how long my shift is, but I am looking for a formula to split the time into Day & Night.
For Example:
I had work from 1800 till 2359. or I had work from 0300 till 0700.
I already have a formula which tells me that I have worked for 0559 and 0400 Hours. But I am unable to get it to split into how much of it is Day and how much of it is Night.
I have been scrolling the web, but no luck!
hoping someone can help me out.
Thanks,
Jagdeep

Related

How to subtract fix hours in an Excel formula?

I've been looking on the internet and here on the site, but I don't find an example: I would like to calculate the difference between two hours, but if one is in the morning (smaller than 12:00) and the other in the afternoon (larger than 13:00), an hour should be subtracted.
As the values "08:00", "16:00" and "17:00" are accepted by Excel, I thought this would be easy, something like:
=IF(AND(B3<=12:00,C3>=13:00),C3-B3-1,C3-B3)
But the values "12:00" and "13:00" are not recognised by Excel. How can I write my formula (as readable as possible, please, calculating 13/24 and using this constant in my formula is not very readable :-) ).
I've opted for this solution:
=IF(AND(B3<=TIME(12,0,0),C3>=TIME(13,0,0)),C3-B3-TIME(1,0,0),C3-B3)
This says precisely what I want: in case I started in the morning (B3<=TIME(12,0,0)) and ended in the afternoon (C3>=TIME(13,0,0)), then I subtract one hour TIME(1,0,0) from the difference (taking lunchtime into account).

Number of minutes in a time range - EXCEL

I have a sheet for tracking my hours at work. We also have a time period between the hours of 07:30 & 18:00 where we can accrue 'flex time'. I want to know from my in and out times, how many hours:minutes I have made in flex.
Please can someone help with the calculation?
The standard way of doing these is to use the overlap formula for two intervals
=max(0,min(end1,end2)-max(start1,start2))
So in your case it would be
=MAX(0,MIN(C2,TIMEVALUE("18:00"))-MAX(B2,TIMEVALUE("7:30")))
If some of your time cells contain strings instead of numbers you would need to check for these. One way of doing it is
=IFERROR(MAX(0,MIN(C2+0,TIMEVALUE("18:00"))-MAX(B2+0,TIMEVALUE("7:30"))),0)
If you ever did a night shift including midnight the formula would need further modification.
Fixed my formula to get correct answers. Bit odd but works now!
=C4+IF(A4-TIME(7,30,0)<0,A4-TIME(7,30,0),0)-IF(B4-TIME(18,0,0)>0,B4-TIME(18,0,0),0)
We take the total time then
if our time starts earlier than flex time starts, we ADD the difference between our start time and flex time, which of course will be a negative number
if our end time ends later than flex time ends, we SUBTRACT the difference between our end time and flex time

excel - timesheet if day before and day after holiday worked

I currently have if the holiday add 8 hours with the following formula.
=IF(SUMPRODUCT((LEFT(TEXT(B5,"mmm"),3)=LEFT(Holidays!$B$2:$B$11,3))*(DAY(B5)=--RIGHT(Holidays!$B$2:$B$11,2))),8,0)
I think what I'm asking for would go where the 8 currently is.
So what I am attempting to do is only add those 8 hours if the scheduled working day before the holiday, and the scheduled working day after the holiday is worked. Now I know this wont put the +8 hours in until the information for the following day is entered but that is fine as long as the week end totals include the holiday.
Is there any way I can go about achieving this?
So, as a temporary solution you can use this in place of 8, in L6 cell:
IF(AND(OFFSET(L6,-1,-3)=8,OFFSET(L6,1,-3)=8),8,0)
You can modify conditions, so they will fit your case in the best way.
This works for Monday-Friday only!

Select pay rate based on day and shift start time

Im creating an excel pay sheet so i can keep tabs on my pay.
I have two pay rates,
£9.30 is paid for hours worked from 6pm to 8am Monday to Thursday
£10.30 is paid for hours worked from 6pm Friday to 8am Monday.
I have a column that displays the pay rate, i want this to populate automatically with excel looking at the day of the week and then the start time and then returning the correct pay rate.
For example,
If the day is a Mon and the start time is 6pm return £9.30
If the day is Fri and the start time is 6pm return £10.30 etc etc
Any one have any ideas on how i can achieve this? Id rather this be formula based instead of VBA if possible but if it cant be formula based then VBA it is.
Thanks in advance
I had to make a few assumptions because your question was unclear about the possible start times for your shifts. Your wording and examples lead me to believe that your shifts always begin at 6 PM regardless of the day. I created a possible solution or start to a solution based on that assumption that does not rely on VBA. I've included links to an excel workbook with my solution and a screen shot. (I'm only allowed 2 links with my current rep.)
As Gowtham Shiva suggested in the comments, a screen shot of what you have so far would be helpful.
I created two tables and a named ranged called “valDays”. To use the workbook, you enter the date and start time for your shift in tblPay. Enter the pay rate for a specific day and time in tblRates. valDays provides a way to convert the text for a day of the week into a number for calculating date/time serial numbers.
Feel free to comment/message me for clarification. I’ll do my best to reply and refine the solution as necessary. I hope you find this answer helpful and appreciate feedback. This is my first time providing an answer on Stack Overflow.
I’m going to assume you know how to name a range, create tables, and rename tables in excel. If you don’t there are plenty of YouTubers and bloggers that cover these topics quite well.
List the days in a column off to the right. (I used column K.) “Sun”, “Mon”, “Tue”, etc. Select all the cells with the days of the week and name the range “valDays”.
Formula in tblRates[Serial]:
“=MATCH(tblRates[[#This Row],[Day]],valDays,0)+tblRates[[#This Row],[Time]]”
Formula in tblPay[Serial]:
“=WEEKDAY([Date])+[StartTime]”
Formula in tblPay[Rate]:
“=INDEX(tblRates[Rate],MATCH([Serial],tblRates[Serial],0))”
You can download the excel document and view these screenshots of a possible solution.
Link to Excel Workbook on Google Drive
Screenshot1

(Excel, workshift) Weekly work hours around fixed amount

Well this problem is a little hard to explain in just one line for the title, but i hope it worked.
Anyway, i have made an excel spreadsheet where i keep track of the time i have worked each week. It has a week number, date, check-in, check-out and hours worked that day.
At the bottom of each week the total sum of hours are calculated and displayed.
Now, the place where i work, i have to work 37 hours each week, if i go under i have to make up for it the next, if i go over i can work that amount less the next week.
So i would like to have something like this under my total hours:
-3 (if i am three hours behind for example), or +4 (if i am four hours over).
Does it make sense? I have tried myself this past time but couldnt get it to work properly.
Total hours worked per week difference from fixed 37 hours: =IF((37-SUM(E3:E7)*24)<0,"-"&TEXT(ABS((37-SUM(E3:E7)*24)/24),"hh:mm"),"+"&TEXT((37-SUM(E3:E7)*24)/24,"hh:mm")).
E3:E7 hours worked per day in TimeFormat. This formula gets the total, and checks if it is less or more than 37 hours, if less then adds "-" to make it look negative, otherwise "+" to make it look positive.

Resources