Time arithmetic

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
2,531
Office Version
  1. 365
Platform
  1. Windows
How can I calculate the hours and minutes between a time and midnight? Suppose I have "10:47 pm" (22:47:00) in A1. What formula do I put in A2 to get the result "1:13", the hours and minutes from 10:47 pm to midnight?

I tried =24:00-A1, but that gets an error.

Thanks
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
You're welcome & thanks for the feedback
 
Upvote 0
... Why does it need to be in quotes?
A time value is a number in Excel; Excel converts 22:47 into a number when you enter it into a cell.
When you try to do arithmetic with strings, Excel tries to convert them into numbers as well:
="24:00"-"22:47" would return 0.050694... that can be formatted as h:mm to display 1:13
="2"+"2" would return 4
="2019-12-25"-"2019-11-26" would return 29, and so son.
 
Upvote 0
A time value is a number in Excel; Excel converts 22:47 into a number when you enter it into a cell.
When you try to do arithmetic with strings, Excel tries to convert them into numbers as well:
="24:00"-"22:47" would return 0.050694... that can be formatted as h:mm to display 1:13
="2"+"2" would return 4
="2019-12-25"-"2019-11-26" would return 29, and so son.
I did know that dates and times are just floating point numbers in units of days. If I enter "6:00", it gets stored as 0.25. But my question is why does "24:00"-A1 work, but 24:00-1 doesn't?
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,054
Latest member
juliecooper255

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