IF Formula Involving Times

cgfrank

Board Regular
Joined
Jun 9, 2014
Messages
51
Hello
I would like to make it so a cell fills in yes or no based on the content of another cell.

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Start Shift[/TD]
[TD]End Shift[/TD]
[TD]Total Hours[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]06:00[/TD]
[TD]18:00[/TD]
[TD]12:00[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Example...
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Start Log[/TD]
[TD]End Log[/TD]
[TD]Total Hrs on Log[/TD]
[TD]Time Diff Shift vs Log[/TD]
[TD]Violation?[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]06:00[/TD]
[TD]18:00[/TD]
[TD]12:00[/TD]
[TD]0:00[/TD]
[TD]No[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]06:00[/TD]
[TD]12:00[/TD]
[TD]6:00[/TD]
[TD]6:00[/TD]
[TD]Yes[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]06:00[/TD]
[TD]21:00[/TD]
[TD]15:00[/TD]
[TD]-3:00[/TD]
[TD]No[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

The first table above shows my guys shift time. from 6 am til 6 pm, a total of 12 hours.
The second table shows times recorded on a log. (start time, end time, total hours).
If the value in Time Diff Shift vs Log (which is calculated by subtracting Total Hrs on Log from Total Hrs) is greater than 0:00, fill in Yes.
If its 0:00 or lower, fill in No.
I want the violation column to automatically fill based on the other data
 
Last edited:

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi,

Does this help?


Book1
ABCDE
1Start ShiftEnd ShiftTotal Hours
26:0018:0012:00
3
4
5Start LogEnd LogTotal Hrs on LogTime Diff Shift vs LogViolation?
66:0018:0012:000:00No
76:0012:006:006:00Yes
86:0021:0015:00-03:00No
Sheet1
Cell Formulas
RangeFormula
C6=B6-A6
D6=IF(C$2-C6<0,"-"&TEXT(ABS(C$2-C6),"hh:mm"),C$2-C6)
E6=IF(C$2<=C6,"No","Yes")


C6, D6, & E6 formulas copied down
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top