Time/Date question...

j844929

Active Member
Joined
Aug 18, 2002
Messages
423
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

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
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.
 
Upvote 0

Forum statistics

Threads
1,225,761
Messages
6,186,894
Members
453,383
Latest member
SSXP

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