# Time/Date question...

#### j844929

##### Active Member
Hi,

I have a worksheet where date cells are formatted as DD/MM/YYYY HH:MM:SS

What I'm trying to do is the following:

Cell A1 shows the date and time a trade took place.

Cell B1 shows the date that the trade starts (Formatted to midnight)

If the date in B1 is one day after the date in A1, but the time displayed in A1 is before 6pm then the target cell should show "0.1"

If the date in B1 is one day after that which is in cell A1, but the time displayed in A1 is after 6pm, then the value in the target cell should be "0.2"

If the date in B1 is significantly after the date in A1, then the target cell should show "0.1"

If the date in cell B1 is the same as the date in A1, then the target cell should show "0.2"

I hope this makes sense... I'd appreciate any suggestions on how to go about this... Any questions for clarification, let me know.

Tim

### Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

#### NBVC

##### Well-known Member
Does this formula do the trick?

=IF(OR(B1-A1<=0.25,B1-A1>1),0.2,0.1)

Note, depending on what you mean when you say "If the date in B1 is significantly after the date in A1, then the target cell should show "0.1" ", then change the part of the formula where B1-A1>1 to something else larger than 1. Right now, the formula says that if the date is more than 24 hours, it's significant enough to result in 0.2.

Replies
4
Views
130
Replies
2
Views
362
Replies
6
Views
575
Replies
0
Views
126
Replies
7
Views
476

1,196,015
Messages
6,012,861
Members
441,737
Latest member
bijayche

### 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.

### Which adblocker are you using?

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

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