{"id":1006,"date":"2017-02-27T23:23:49","date_gmt":"2017-02-27T17:23:49","guid":{"rendered":"http:\/\/xlfxs.com\/?p=1006"},"modified":"2017-02-27T23:23:49","modified_gmt":"2017-02-27T17:23:49","slug":"convert-time-in-cell-to-number-of-hours","status":"publish","type":"post","link":"https:\/\/xlfxs.com\/?p=1006","title":{"rendered":"Calculate hours between two cells"},"content":{"rendered":"<p>We needed that several times in the past<br \/>\nThen I found it in an old file in my laptop, thought to share it for others to help<\/p>\n<p>So, when A1 has the start time, B1 has the end time<br \/>\nTime different in one day will be from formula<\/p>\n<pre>=IF(OR(A1=\"\",B1=\"\"),\"\",ABS((HOUR(A1)+MINUTE(A1)\/60)-(HOUR(B1)+MINUTE(B1)\/60))&amp;\" hrs\")<\/pre>\n<p><a href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/02\/1006-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1010\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/02\/1006-2-300x199.png\" alt=\"\" width=\"300\" height=\"199\"><\/a><\/p>\n<p><a href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/02\/1006-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1009\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/02\/1006-1-300x209.png\" alt=\"\" width=\"300\" height=\"209\"><\/a><\/p>\n<p><a href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/02\/100603.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1008\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/02\/100603-300x219.png\" alt=\"\" width=\"300\" height=\"219\"><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>I added to prevent having -ve number of hours in case start time and end times switched between A1 and B1<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We needed that several times in the past Then I found it in an old file in my laptop, thought to share it for others to help So, when A1 has the start time, B1 has the end time Time different in one day will be from formula =IF(OR(A1=&#8221;&#8221;,B1=&#8221;&#8221;),&#8221;&#8221;,ABS((HOUR(A1)+MINUTE(A1)\/60)-(HOUR(B1)+MINUTE(B1)\/60))&amp;&#8221; hrs&#8221;) &nbsp; I added to prevent&#8230;<\/p>\n<p class=\"more-link-wrap\"><a href=\"https:\/\/xlfxs.com\/?p=1006\" class=\"more-link\">Read More<span class=\"screen-reader-text\"> &ldquo;Calculate hours between two cells&rdquo;<\/span> &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":1008,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[66,15,23,29,80,35,48,6],"tags":[],"class_list":["post-1006","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-abs","category-basic-math","category-date-and-time","category-hour","category-if","category-logical","category-or","category-standard_functions"],"_links":{"self":[{"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/posts\/1006","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1006"}],"version-history":[{"count":0,"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/posts\/1006\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/media\/1008"}],"wp:attachment":[{"href":"https:\/\/xlfxs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1006"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1006"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1006"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}