Formula for coming up with a final time - excel

I just want to ask if it's possible to make a formula that will result to a final time that I need? If possible, how can I do it?
For example, if a time is after business hours today, the formula should add a certain number of hours to have a result of 8AM the following day, else, add zero hours. Consider this as a reverse of time difference formula.
Thanks in advance. Just need this to set SLA deadlines for work.

Hope this helps for you, Please alter working hours in the formula per your needs,
Formula,
=TEXT(IF(AND(D2>TIME(8,0,0),D2<TIME(17,0,0)),D2,TIME(8,0,0)),"hh:mm")

Related

Excel IF formula between two times in day

I would like to have a formula that will tell me if the time in a cell is between a range of time by returning a Yes or No value.
I used a code for one time, but am having a hard time expanding the formula for two times.
=IF(G2="","",IF(G2<(--"12:00 PM"),"Yes","No"))
The above code works
=IF(H2="","",IF(H2<(--"12:00 PM"),H2<(--"3:00PM")),"Yes","No"))
Any help is appreciated
Use AND():
=IF(H2="","",IF(AND(H2<(--"12:00 PM"),H2>(--"3:00 PM")),"Yes","No"))
You may try this way as well,
=IF(H2="","",IF(AND(H2<0.5,H2>0.625),"Yes","No"))
Where 0.5=12:00 PM
Where 0.625=3:00 PM

Easy Excel Formula

Have an excel question. I am looking to see if something states "complete" in one cell and if yes then look at a date in another cell and then count how many are within 30 day period of today's date. Below I know its wrong but might be able to get a better idea of what I am trying to do.
=sumifs(Main!B:B="Completed",Main!H:H,"<30")
You should be using COUNTIFS:
For 30 days window in the future:
=COUNTIFS(Main!B:B,"Completed",Main!I:I,">="&TODAY(),Main!I:I,"<"&TODAY()+30)
For 30 days window in the Past:
=COUNTIFS(Main!B:B,"Completed",Main!I:I,"<"&TODAY()+1,Main!I:I,">="&TODAY()-30)
=COUNTIFS(Main!B:B,"Completed",Main!H:H,"<="&TODAY(),Main!H:H,"<"&TODAY()+30)

Find earliest entry in a table

Consider the following table of employees.
It's fairly simple right? Clock in when you start, clock out for lunch, clock back in after lunch, clock out when you leave. But can someone please tell me what time these employees actually started? So for example how would you go about saying Tom was here at 6:51 AM and not at 12:23 PM?
For more reference, all entries look like this. They have at least 4 entries, (some one, no lunch).
How do I go about writing a formula that returns the start time?
I edited the table and added a helper column for the date. See below.
ANSWER:
=AGGREGATE(15,6, $C$2:$C$7/((A11=$A$2:$A$7)*(B11=$B$2:$B$7)),1)
If the working hours are within the day, you can search for the smallest time. If there is a night shift over midnight, then there is a problem ...
=AGGREGATE(15,6,(1/($A$2:$A$5=A2)*(INT(B2)=INT($B$2:$B$5)))*($B$2:$B$5),1)
I've written down this formula for range E2:
=IF(AND(A2=A3,TRUNC(B2,0)-TRUNC(B3,0)=0),MIN(B2,B3),IF(AND(IFERROR(TRUNC(B2)-TRUNC(B1)=0,FALSE),E1=MIN(B2,B1)),"",B2))"
Since english is not my default language on Excel, i've just manually translated it. Anyway, just in case, here is the VBA code to paste it in range E2:
Range("E2").FormulaR1C1 = "=IF(AND(RC[-4]=R[1]C[-4],TRUNC(RC[-3],0)-TRUNC(R[1]C[-3],0)=0),MIN(RC[-3],R[1]C[-3]),IF(AND(IFERROR(TRUNC(RC[-3])-TRUNC(R[-1]C[-3])=0,FALSE),R[-1]C=MIN(RC[-3],R[-1]C[-3])),"""",RC[-3]))"
I've tried various configurations and it works for me. Only point: list must be sorted by Name and Clock In.

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

How to easily compute time in Excel

I want to do quick calculations in Excel. I have a cell (A1) with 50:00:00. I do =A1+1 and get 74:00:00. So, I guess 1=24 hours=1 day. However, I try =A1+1:23:45 and get an error. Is there an easy way to add hours to hours in Excel? If not, do you have a better tool?
Please don't say something like =A1+1/24+23/24/60+45/24/60/60. That's not easy in my book.
Just use =A1+Time(1,23,45) for this.
You can use the Time function which takes as parameters, hour, minute, seconds, respectively.
So to ad 1 hour to the date in A1, you would type = A1 + Time(1,0,0)

Resources