简体   繁体   中英

How to subtract two date columns(format: 2019-01-31 23:45:45+01:00) in Excel and display in hours?

Let say I have two columns:

Creation Date                Delivery date                 hours
2019-01-31 23:45:45+01:00    2019-02-01 15:18:21+01:00     ?

can anyone please help me in doing this?

Their are other ways but this works:

=((DATE(LEFT(C3,4),MID(C3,6,2),MID(C3,9,2))-DATE(LEFT(B3,4),MID(B3,6,2),MID(B3,9,2)))-1)+((1-(TIME(MID(B3,12,2),MID(B3,15,2),MID(B3,18,2))))+TIME(MID(C3,12,2),MID(C3,15,2),MID(C3,18,2)))*24

in case it is text, c3 is delivery, b3 is creation.

Use VALUE and LEFT functions:

=(VALUE(LEFT(B2,LEN(B2)-6))-VALUE(LEFT(A2,LEN(A2)-6)))

and format number in result column with custom format [h]:mm or [h]

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM