I'm trying to make a formula to find the difference between 2 time, and also have a condition like this :
If work time > 8 hours, then the difference from work time become the overtime
And here's the image of my table in Excel :
the table
Can you please tell me what to write the formula?
Formula for worktime
=F2-E2
Formula for Overtime
=MAX(G2-(1/3),0)
If you would like the work time and overtime to be formatted as number (e.g 1 instead of 1:00), use the formulas below and format your cells to be numbers
=(F2-E2)*24
=MAX(G2-8,0)
Related
Purpose of Post
Trying to determine why the WORKDAY.INTL formula in cell "F2" of the attached workbook picture seems to be calculating the incorrect date. I expected the date be 8/16/21. It is showing as 8/12/21.
The attached picture is a screenshot of my workbook that contains a table of tasks. The columns to the right of the tasks column are explained below.
Start Date: the date that the task will be started.
Due Date: the date that the task is due/will be finished.
Hours of Work: the estimated amount of hours that it will take to complete the task.
Percent Dedication: The percentage of my time in a workday that I will dedicate to that task.
Start Date Check: Calculates the latests day you can start the task to finish on the specified due date given the hours of work required and the percent dedication.
Due Date Check: Calculates when the work will be finished if started on the specified start date given the hours of work required and the percent dedication.
Working Hours: Number of hours in each working day.
Formulas in Cells
Cell "E2": =([#[Hours of Work]]/(NETWORKDAYS.INTL([#[Start Date]],[#[Due Date]],"0000111")*J1))
Cell "F2": =WORKDAY.INTL([#[Due Date]],(-1)*([#[Hours of Work]]/([#[Percent Dedication]]*J1))+1,"0000111")
Cell "G2": =WORKDAY.INTL([#[Start Date]],[#[Hours of Work]]/([#[Percent Dedication]]*J1)-1,"0000111")
Here's your problem in it's simplest form:
Column C shows the formulas that are being used in Column B.
The formula in B3 is displaying the correct answer.
However, the formula in B4 treats B3 as though it is -11. This is almost certainly due to floating-point arithmetic, especially considering that the 10/11 part of the formula is a non-terminating number. This is much too complicated of a subject to get into, but essentially it means that the result is not -10 and is something like -10.0000000...00000004815162342 because of the slight imprecision.
The solution is to round the result to an integer, so that we ignore the tiny amount of imprecision. For our test case, we would do this:
By rounding the answer, we have obtained the correct result.
For your workbook we can do the same thing. The formula in E2 would become:
=WORKDAY.INTL([#[Due Date]],ROUND(-([#[Hours of Work]]/([#[Percent Dedication]]*J1))+1,0),"0000111")
Which gives the correct answer:
I would suggest doing the same for the formula in G2 as well, which would be:
=WORKDAY.INTL([#[Start Date]],ROUND([#[Hours of Work]]/([#[Percent Dedication]]*J1)-1,0),"0000111")
I’m so rusty on excel and I’m trying to work out a formula for this problem:
Shifts greater than 5 hours duration must take a 1 hour unpaid break.
I’m using for G5 =IF(G4>5:00:00,”1:00:00”,”0:00:00”)
G4 =shift duration, cell is formatted as [h]:mm
Once I get this to work I then add G4 and G5 and to get the shift finish time.
It sounds so simple but it’s driving me crazy!!! Any help would be appreciated!
Excel stores time field internally as numbers, where 1 is a complete day (which is 24 hours).
If G4 has the value "06:30" (a time ), Then a formula in G5 like this:
=G4*24, will give you the numeric value 6.5.
You formula to check for more than 5 hours can be:
IF(G4*24>5,"01:00:00","00:00:00")
But this will return a text (i.e.:"01:00:00"). This can be solved by adding the function TIMEVALUE()
=TIMEVALUE(IF(G4*24>5,"01:00:00","00:00:00"))
EDIT:
Another way can be:
=IF(G4>TIME(5,0,0),"01:00:00","00:00:00")
On my planner I have a section with recurring dates (see pic below) that I use to copy/paste cells into the main body of my planner as needed.
I use the formula below (Thursday shown) for 'recurring every week', but what about 'recurring every 2 weeks'? I'll need to use the DATE() function I think, copy/paste and then edit the date in the formula each time, I'm OK with that, but struggling to come up with the right formula.
=IF(WEEKDAY(TODAY())=5,TODAY(),TODAY()-WEEKDAY(TODAY())+5 + IF(WEEKDAY(TODAY())>=5,7))
In order to create a 2-week switch, I'd go for a weeknumber mod 2:
=MOD(WEEKNUM(TODAY(),11),2)
This gives 1 for odd, and 0 for even week numbers.
Good luck
I'm trying to calculate the time between the dates , at the beginning the formula
was working fine but I've noticed that it does not work when the date is different
For example , I have the following information on cell A1: 09/15/2016 10:00 AM
On Cell B2 I have: 09/16/2016 10:00 AM
The formula is just B2-A1 but instead of giving me a result of 24 hours is just giving me 0 . I believe the formula is not recognizing that these are 2 different days and is just doing 10-10
Any idea how to fix this ?
I was able to get the result 24 by setting a custom format of [h] (you will have to type it into the 'Type:' box) on cell C1 while using the formula =B1-A1
Excel Reference
'Format Cells' view
The problem with just using =B1-A1 is that if either or both of those cells is not populated then you will get weird numbers in C1. You may want to make C1 display as a blank cell unless both boxes are populated, try something like this =IF(OR(ISBLANK(A1),ISBLANK(B1)),"",B1-A1)
The reason for the weird numbers is that Excel calculates time based on a predefined decimal system that indexes time starting at like 1/1/1900 or something like that. So when manipulating or calculating time, that is something that you always have to keep in the back of your mind.
Hope this helps.
Formation the destination cell to will do but since you have date and time combined it will show as 1 calendar day difference 0 only means that 12 am after the 1 day difference, I know it does not make any sense but its Excel...
If I was you, on column A, I would add the date, and on Column B, the time.
then just work with the time, as both combined can be tricky
Don't forget to format your cells!! (right click>Format Cells>Time>3/14/12 1:30 PM)
I have excel data in the following format
Date Amount
01-Jan-16 23.94
12-Jan-16 17.96
26-Jan-16 32.92
03-Feb-16 38.90
20-Feb-16 62.27
26-Feb-16 45.89
I would like to sum the amount field for specific months, that is I would like to sum up the amount in January and also in February separately.
This is the code I have tried thus far which I found in a previously asked question (see Excel Formula to SUMIF date falls in particular month).
=SUM(IF(MONTH(A:A)=1,B:B,0))
It works for January but when I change 1 to 2 it returns zero.
=SUM(IF(MONTH(A:A)=2,B:B,0))
Would sumifs work better?
Here are two other ways of doing it:-
=SUMPRODUCT((MONTH(A2:A10)=1)*B2:B10)
and
=SUMIFS(B2:B10,A2:A10,">="&DATE(2016,1,1),A2:A10,"<"&DATE(2016,2,1))
Change as necessary to get totals for other months.
I have put the results next to the original array formula in this screen shot:-
Use specific range rather than full column. You must use the formula as array formula.
=SUM(IF(MONTH($A$2:$A$1000)=1,$B$2:$B$1000,0))
Press CTRL+SHIFT+ENTER to evaluate the formula as array formula.