How to reference Time in a Date/Time Field

Liz_I3

Well-known Member
Joined
Dec 30, 2002
Messages
647
Office Version
  1. 2016
Platform
  1. Windows
Hi
Column F & G are date/time fields formatted as 3/14/12 1:30 PM . In Column H I want an if statement that says if the time portion of F or G is less than 7:00 AM bump the time up to 7:00 AM else let it be what it is

Example
F H
7/21/2020 7:39:09 AM 7/21/2020 7:39:09 AM H would remain as 7/21/2020 7:39:09 AM
7/22/2020 3:31:39 AM 7/22/2020 7:00:00 AM H would become 7/22/2020 7:00:00 AM

I was trying to use the Mod(F2,1) function If (Mod(f2,1) < 7:00:00 AM, int(f2) & 7:00:00 AM,F2) but it is obviously wrong

Thanks
Liz
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Try this formula, for an entry in row 2:
Excel Formula:
=IF(F2-INT(F2)>(7/24),F2,INT(F2)+(7/24))
 
Upvote 0
Thank you both they are both working. Thanks so very much

Liz
 
Upvote 0
Thank you both they are both working. Thanks so very much

Liz
 
Upvote 0

Forum statistics

Threads
1,214,620
Messages
6,120,554
Members
448,970
Latest member
kennimack

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