Difference between two dates in hours

smide

Board Regular
Joined
Dec 20, 2015
Messages
162
Office Version
  1. 2016
Platform
  1. Windows
Hello.


In columns B and C (B2:B600, C2:C600) I'm receiving dates (with hours and minutes) in rather strange form - without current year?


For example in cell B2: 12.02. 19:07


Explanation: 12 - day, 02 - month (February), then after 02. there is a one space, 19 - hours, 07 - minutes


In cell C2: 14.02. 11:05


I need to calculate difference between dates C2-B2 in hours.


Note: all those dates have the same year 2018

Example:

ABCD
1
212.02. 19:0714.02. 11:05 C2-B2 (in hours)
3............
4............

<tbody>
</tbody>

 
Last edited:

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
smide, Good afernoon.

Are your data a TEXT or a REAL DATE with a strange Cell format?
 
Upvote 0
you should just parse the text and create dates, then you can add/subtract them... the result will be in days and you can multiply by 24 to get hours....

you need to use functions like MID SEARCH LEFT RIGHT to parse text and then use the date function to create a date with the parsed values

https://www.techonthenet.com/excel/formulas/date.php
 
Last edited:
Upvote 0
Try this in D2:

=(DATE(2018,MID(C2,4,2),LEFT(C2,2))+RIGHT(C2,5)-(DATE(2018,MID(B2,4,2),LEFT(B2,2))+RIGHT(B2,5)))*24

or

=DATE(2018,MID(C5,4,2),LEFT(C5,2))+RIGHT(C5,5)-(DATE(2018,MID(B5,4,2),LEFT(B5,2))+RIGHT(B5,5)) formatted as Custom [h]:mm
 
Upvote 0

Forum statistics

Threads
1,216,434
Messages
6,130,611
Members
449,584
Latest member
c_clark

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