Subtracting Dates

cart0250

Active Member
Joined
Jun 24, 2006
Messages
284
Office Version
  1. 2016
Platform
  1. Windows
Hello

I'm trying to subtract a date/time in m/d/yyyy h:mm format from the current date/time.

I have the following formula :
=IFERROR(INT(NOW()-A1)&" days " & TEXT(NOW()-A1,"h""hrs ""m""mins"""),"")

If the current date/time is 1/24/2018 8:51 and the date in A1 is 1/23/2018 1:20, the formula correctly yields the difference as 1 days 7hrs 31mins.

What I'd like is to just calculate the difference in hours and minutes (not days)

So in this example, result would be 31 hrs 31 mins.

Does anyone know how can I modify the above formula?

Thanks for your help
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Or alternatively just use:

=NOW()-A1

And custom format the cell that contains the formula using.

Code:
[h] "hrs" m "Mins"
 
Upvote 0
Is there a way to do this but just for the date and not the time? I have dates that are downloaded as X/XX/XXXX XX:XX:XX PM but I want to subtract one date field from another. My chart shows too many dates b/c of the times included.
 
Upvote 0
You can remove the time part of a date/time by using INT(). For example:

Code:
=INT(B1)-INT(A1)

WBD
 
Upvote 0
Is there a way to do this with just the time? What I've done is just subtract one date from the other, and formatted the cell where I was putting the info to display hh:mm:ss and that worked fine at first.

Now I need to find out if that hh:mm:ss is greater or less than 00:15:00, but I can't figure out how to set up the subtraction so that I can make that comparison. Any ideas would be appreciated.
 
Upvote 0

Forum statistics

Threads
1,215,106
Messages
6,123,123
Members
449,096
Latest member
provoking

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