Hi
Cindy,
To subtract
12 hours from a
date/time cell, you can use the following formula:
- =IF(B1A1,B1-TIME(12,0,0),"")
Here's how it works:
1. The
IF function checks if the date in
B1 is greater than the date in
A1. If it is, the formula subtracts
12 hours from the date/time in
B1. If it's not, the formula returns an empty string ("").
2. The
TIME function creates a time value of
12:00:00 AM (i.e.
12 hours) that can be subtracted from the date/time in
B1.
3. The result is displayed in cell
C1.
Make sure that the format of cell
C1 is set to
date/time format so that the result is displayed correctly.
Formula:
Note: No macro or Visual Basic code found in the text.