{"id":992,"date":"2019-05-02T12:54:06","date_gmt":"2019-05-02T09:54:06","guid":{"rendered":"https:\/\/www.test4u.eu\/excelpedia\/?p=992"},"modified":"2019-05-02T12:54:12","modified_gmt":"2019-05-02T09:54:12","slug":"the-datedif-function","status":"publish","type":"post","link":"https:\/\/www.test4u.eu\/excelpedia\/the-datedif-function\/","title":{"rendered":"The DATEDIF Function"},"content":{"rendered":"\n<p>Calculates the number of days, months, or years between two dates. This function is only provided for compatibility with older Lotus 1-2-3 workbooks. It is a hidden function and will not appear in Excel&#8217;s autocomplete.<\/p>\n\n\n\n<p>The syntax of the function is the following: <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-style-large is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>DATEDIF<\/strong><em>(<strong>start_date<\/strong><span><b>, end_date, unit<\/b><\/span><\/em>) <\/p><cite><strong>start_date<\/strong>: The start date of the period&#8217;s length we wish to calculate.     <br><strong>end_date<\/strong>: The end date of the period&#8217;s length we wish to calculate.   <br><strong>unit<\/strong>: The type of difference we want to calculate.<br><\/cite><\/blockquote>\n\n\n\n<p>The unit argument takes the following values:<\/p>\n\n\n\n<table class=\"wp-block-table is-style-stripes\"><tbody><tr><td><strong>Unit<\/strong><\/td><td><strong>Returns<\/strong><\/td><\/tr><tr><td>&#8220;Y&#8221;<\/td><td>The number of years in the period<\/td><\/tr><tr><td>&#8220;M&#8221;<\/td><td> The number of months in the period <\/td><\/tr><tr><td>&#8220;D&#8221;<\/td><td>The number of days in the period<\/td><\/tr><tr><td>&#8220;MD&#8221;<\/td><td>The difference in days between start_date and end_date. <br>The months and years are ignored<\/td><\/tr><tr><td>&#8220;YM&#8221;<\/td><td>The difference in months between start_date and end_date. <br> The days and years are ignored<\/td><\/tr><tr><td>&#8220;YD&#8221;<\/td><td>The difference in days between start_date and end_date. <br> The years are ignored<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>If the start_date is greater than the end_date the #NUM! error is returned.<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Click on the button to practice using this function, with the help of our <strong>Online Assessment Tool<\/strong>:<\/p>\n\n\n<p class=\"button-practice-container\" ><a class=\"button button-primary button-practice\" style=\"height:auto\"  href=\"https:\/\/www.test4u.eu\/excelpedia\/wp-content\/plugins\/unlimited-integration\/run.php?id=NmwzVmFINmZhcWwwMWE1dzJkRVUzMEw5NWh6T0pVRW9hcjhrb2wxaFJGR0VEcGxzbWVKNjlHWHp1VXVtTE9wNw==&b=aVRxdFhMVHVydHBRTmVCR1c2N21rK1ByTE1ON1FoS1NiNHhSMmlZMzExeUhFM3RKY3YrT25oOU1mWDB0SVBONnplMTVBZlYvK1puSTJDMVMxM0ZYYUFZSXFOa21qSkxqZWQ5NStsOVhmb0E9\">Practice<\/a><\/p>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n\n<p class=\"has-medium-font-size\"><strong>Here is an example of how to use the DATEDIF function:<\/strong><\/p>\n\n\n\n<p>In the cell D1 enter your birth date.<br>\nIn the cell D3 calculate the difference in days between the date in D1 cell and today.<br>\nIn the cell D4 calculate the difference in days, ignoring the months, between the date in D1 cell and today.<br>\nUse DATEDIF (hidden) function, in order to solve this exercise.<\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-4-3 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><iframe class=\"youtube-player\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/_Fs-hVYUeQk?version=3&#038;rel=0&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=en-US&#038;autohide=2&#038;wmode=transparent\" allowfullscreen=\"true\" style=\"border:0;\" sandbox=\"allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox\"><\/iframe><\/span>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Calculates the number of days, months, or years between two dates. This function is only provided for compatibility with older Lotus 1-2-3 workbooks. It is a hidden function and will not appear in Excel&#8217;s autocomplete.<\/p>\n","protected":false},"author":2,"featured_media":993,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4],"tags":[133,140],"class_list":["post-992","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-functions","tag-date-time","tag-datedif"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.test4u.eu\/excelpedia\/wp-content\/uploads\/2019\/05\/datedif.jpg","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paRnIz-g0","_links":{"self":[{"href":"https:\/\/www.test4u.eu\/excelpedia\/wp-json\/wp\/v2\/posts\/992","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.test4u.eu\/excelpedia\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.test4u.eu\/excelpedia\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.test4u.eu\/excelpedia\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.test4u.eu\/excelpedia\/wp-json\/wp\/v2\/comments?post=992"}],"version-history":[{"count":0,"href":"https:\/\/www.test4u.eu\/excelpedia\/wp-json\/wp\/v2\/posts\/992\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.test4u.eu\/excelpedia\/wp-json\/wp\/v2\/media\/993"}],"wp:attachment":[{"href":"https:\/\/www.test4u.eu\/excelpedia\/wp-json\/wp\/v2\/media?parent=992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.test4u.eu\/excelpedia\/wp-json\/wp\/v2\/categories?post=992"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.test4u.eu\/excelpedia\/wp-json\/wp\/v2\/tags?post=992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}