Subtracting Date/Time from Date/Time

fishin

Board Regular
Joined
Jan 18, 2009
Messages
184
Cell J226 is formatted as Date/Time. I want to subtract today’s current Date/Time from the Date/Time in J226 and have the result expressed as part of a day (24 hrs.) In other words, if the difference between the Date/Time in J226 minus the current/Date/Time is equal to 36 hours, the recipient cell would reflect a value of 1.50. If cell J226 is blank, I want the recipient cell to remain blank.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
When you say Date/Time, what is the actual format?

I tested this using the format, custom> m/d/yyyy hh:mm, and this formula:

K226: =(j226-now()) and this gives you the time in days


Do you want the date "today" to update constantly? If yes, use now(), if you want a static "today" use today() in the formula instead.

Reverse the order if you want to change whether it is +/- or insert =abs(j226-now()) to always have a + answer
 
Upvote 0
Thanks. I'd like the result of that action =(J226-NOW()) to take place and post conditionally in the recipient cell if the resulting value is equal or greater than zero but less than 1.60 and only if J226 is not blank. If J226 is blank, the recipient cell is to remain blank.
 
Upvote 0
I can't do what you ask directly because that creates a circular reference I believe (or I just don't know excel well enough yet), but you can accomplish your request using a work around.


1. Create a blank column for the =j226-now()------Im going to assume for this example you create column K

2. Change the formula to say =if(j226="","",j226-now()) --this will leave K226 blank if nothing is in J266 (request #1)

3. In your "recipient cell" (wherever that is) use this formula:

=IF(AND(K226>=0,K226<=1.6),K226,"") (request #2, if your number is between 0 and 1.6 it will appear, if not it is left blank)

4. Hide the column you created in step 2
 
Upvote 0

Forum statistics

Threads
1,224,592
Messages
6,179,789
Members
452,942
Latest member
VijayNewtoExcel

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