Issue with 00:00 time when using an IF function

Charles_P

New Member
Joined
Mar 23, 2022
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Can anyone help me solve this?

I am trying to use a simple IF function to display which shift is working based on a series of time entries. I am working with a UTC time set, but I need to adjust the times to be UTC+1, to use this I am using a simple addition calculation. However, when I apply the IF function to the adjusted (UTC+1) time entries, it returns the same results as the UTC time set around 00:00, but outputs correctly around 12:00 (the shift change times). If I manually type in the adjusted times, the IF function works as expected. What is going on?

The functions being used are;

  • =A2+(1/24) Where A2 is UTC time - I have tried other methods of adding 1hr but all return the same result as described above, so I do not think that this is where the issue lies.
  • =IF(A2>(12/24),"DAYS","NIGHTS") Where A2 is UTC time - This works as expected
  • =IF(B2>(12/24),"DAYS","NIGHTS") Where B2 is UTC+1 time - reruns the same result as UTC time around 00:00, but correctly adjusts around 12:00 - Again, I have tried other forms of writing 12:00 within the function, but all yield the same outcome around 00:00.
  • =IF(E8="","",IF(E8>(12/24),"DAYS","NIGHTS")) Where E8 is manually written time and this works as expected - Obviously the first IF function is there just to keep things tidy - I have tired without this and there is the same correct outcome.

I have included a sample of the dataset and the formulas actively being applied.

Thank you in advance,

Charles

IF Function 0000 Time Error.xlsx
ABCDEF
1UTC TIMEUTC+1Shift UTCSHIFT UTC+1Manually typed UTC+1 Time SHIFT UTC+1
219:17:1920:17:19DAYSDAYS 
319:37:3720:37:37DAYSDAYS 
420:08:1421:08:14DAYSDAYS 
520:31:3021:31:30DAYSDAYS 
620:51:4521:51:45DAYSDAYS 
722:14:5123:14:51DAYSDAYS 
822:38:2323:38:23DAYSDAYS23:38:23DAYS
922:58:0823:58:08DAYSDAYS23:58:08DAYS
1023:20:310:20:31DAYSDAYS00:21:31NIGHTS
110:10:271:10:27NIGHTSNIGHTS01:10:27NIGHTS
120:39:301:39:30NIGHTSNIGHTS 
131:28:292:28:29NIGHTSNIGHTS 
142:05:333:05:33NIGHTSNIGHTS 
152:32:183:32:18NIGHTSNIGHTS 
162:57:503:57:50NIGHTSNIGHTS 
173:27:434:27:43NIGHTSNIGHTS 
184:01:545:01:54NIGHTSNIGHTS 
194:34:095:34:09NIGHTSNIGHTS 
204:56:355:56:35NIGHTSNIGHTS 
215:18:426:18:42NIGHTSNIGHTS 
225:46:186:46:18NIGHTSNIGHTS 
236:03:057:03:05NIGHTSNIGHTS 
246:25:087:25:08NIGHTSNIGHTS 
256:48:537:48:53NIGHTSNIGHTS 
267:09:028:09:02NIGHTSNIGHTS 
277:30:278:30:27NIGHTSNIGHTS 
287:51:078:51:07NIGHTSNIGHTS 
298:10:229:10:22NIGHTSNIGHTS 
309:04:1010:04:10NIGHTSNIGHTS 
319:22:2510:22:25NIGHTSNIGHTS 
329:30:2110:30:21NIGHTSNIGHTS 
339:35:3810:35:38NIGHTSNIGHTS 
349:41:4910:41:49NIGHTSNIGHTS 
359:49:4610:49:46NIGHTSNIGHTS 
369:55:2310:55:23NIGHTSNIGHTS 
3710:03:1311:03:13NIGHTSNIGHTS 
3810:09:4711:09:47NIGHTSNIGHTS 
3910:17:2311:17:23NIGHTSNIGHTS 
4010:25:2711:25:27NIGHTSNIGHTS 
4110:33:4711:33:47NIGHTSNIGHTS 
4214:03:0315:03:03DAYSDAYS 
4314:16:3915:16:39DAYSDAYS 
4414:28:5815:28:58DAYSDAYS 
4514:37:2315:37:23DAYSDAYS 
4614:49:5315:49:53DAYSDAYS 
4715:01:3416:01:34DAYSDAYS 
4815:14:4916:14:49DAYSDAYS 
4915:29:4316:29:43DAYSDAYS 
5015:43:0716:43:07DAYSDAYS 
5115:55:1516:55:15DAYSDAYS 
5216:07:4217:07:42DAYSDAYS 
5316:21:4317:21:43DAYSDAYS 
5416:36:3817:36:38DAYSDAYS 
5516:51:3317:51:33DAYSDAYS 
5617:26:3718:26:37DAYSDAYS 
5717:44:3918:44:39DAYSDAYS 
5818:06:0119:06:01DAYSDAYS 
5918:31:0019:31:00DAYSDAYS19:31:00DAYS
6023:20:120:20:12DAYSDAYS00:20:12NIGHTS
6123:48:360:48:36DAYSDAYS00:48:36NIGHTS
620:02:511:02:51NIGHTSNIGHTS01:02:51NIGHTS
630:17:291:17:29NIGHTSNIGHTS01:17:29NIGHTS
640:35:041:35:04NIGHTSNIGHTS 
650:50:211:50:21NIGHTSNIGHTS 
661:32:362:32:36NIGHTSNIGHTS 
6717:49:5718:49:57DAYSDAYS 
6818:03:4419:03:44DAYSDAYS 
6918:15:4119:15:41DAYSDAYS 
7018:27:5119:27:51DAYSDAYS 
7118:43:1119:43:11DAYSDAYS 
7218:54:1919:54:19DAYSDAYS 
7319:04:5820:04:58DAYSDAYS 
7419:19:0120:19:01DAYSDAYS 
7519:32:0720:32:07DAYSDAYS 
7619:46:1120:46:11DAYSDAYS 
7720:14:5121:14:51DAYSDAYS 
7822:17:2923:17:29DAYSDAYS 
7922:28:0323:28:03DAYSDAYS23:28:03DAYS
8022:46:3723:46:37DAYSDAYS23:46:37DAYS
8123:11:420:11:42DAYSDAYS00:11:42NIGHTS
8223:26:380:26:38DAYSDAYS00:26:38NIGHTS
8323:35:480:35:48DAYSDAYS00:35:48NIGHTS
8423:48:300:48:30DAYSDAYS00:48:30NIGHTS
850:00:451:00:45NIGHTSNIGHTS01:00:45NIGHTS
860:14:291:14:29NIGHTSNIGHTS 
870:28:441:28:44NIGHTSNIGHTS 
880:43:211:43:21NIGHTSNIGHTS 
890:56:181:56:18NIGHTSNIGHTS 
901:12:512:12:51NIGHTSNIGHTS02:12:51NIGHTS
911:25:352:25:35NIGHTSNIGHTS02:22:35NIGHTS
9223:35:560:35:56DAYSDAYS00:35:56NIGHTS
9323:54:350:54:35DAYSDAYS00:54:35NIGHTS
940:22:011:22:01NIGHTSNIGHTS01:22:01NIGHTS
950:48:101:48:10NIGHTSNIGHTS01:48:10NIGHTS
960:59:441:59:44NIGHTSNIGHTS 
971:10:242:10:24NIGHTSNIGHTS 
981:18:372:18:37NIGHTSNIGHTS 
991:36:552:36:55NIGHTSNIGHTS 
1006:06:377:06:37NIGHTSNIGHTS 
1016:15:277:15:27NIGHTSNIGHTS 
1026:23:597:23:59NIGHTSNIGHTS 
1036:33:567:33:56NIGHTSNIGHTS 
1046:43:367:43:36NIGHTSNIGHTS 
1056:52:207:52:20NIGHTSNIGHTS 
1067:01:178:01:17NIGHTSNIGHTS 
1077:08:288:08:28NIGHTSNIGHTS 
1087:17:588:17:58NIGHTSNIGHTS 
10910:28:0811:28:08NIGHTSNIGHTS11:28:08NIGHTS
11010:51:2211:51:22NIGHTSNIGHTS11:51:22NIGHTS
11111:40:4712:40:47NIGHTSDAYS12:40:47DAYS
11211:50:2112:50:21NIGHTSDAYS12:50:21DAYS
11311:55:1812:55:18NIGHTSDAYS12:55:18DAYS
11412:20:4013:20:40DAYSDAYS13:20:40DAYS
11512:31:0913:31:09DAYSDAYS 
11612:40:5413:40:54DAYSDAYS 
11712:50:4513:50:45DAYSDAYS 
11812:58:3413:58:34DAYSDAYS 
11913:08:0914:08:09DAYSDAYS 
12013:15:4614:15:46DAYSDAYS 
121
Sheet1
Cell Formulas
RangeFormula
B2:B120B2=A2+(1/24)
C2:D120C2=IF(A2>(12/24),"DAYS","NIGHTS")
F2:F120F2=IF(E2="","",IF(E2>(12/24),"DAYS","NIGHTS"))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A1Expression=$G1="Incomplete"textNO
A1Expression=$G1="Complete"textNO
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Hi,

You added a day when you add 1 hour to times crossing midnight, change your B Column formula to:

Excel Formula:
=MOD(A2+(1/24),1)

Copied down.
 
Upvote 0
Solution
Thank you for the quick response! I thought I was going mad, but that actually makes perfect sense!

Thank you again!
 
Upvote 0
You're welcome, thanks for the feedback, glad to help.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,193
Members
452,616
Latest member
intern444

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