{"id":4441,"date":"2016-02-12T11:14:50","date_gmt":"2016-02-12T10:14:50","guid":{"rendered":"https:\/\/www.itlektor.cz\/?p=4441"},"modified":"2021-11-11T17:41:38","modified_gmt":"2021-11-11T16:41:38","slug":"skryta-funkce-datedif","status":"publish","type":"post","link":"https:\/\/www.itlektor.cz\/en\/skryta-funkce-datedif\/","title":{"rendered":"Hidden function DATEDIF"},"content":{"rendered":"<p><\/p>\n<p style=\"text-align: justify;\">You may know that Excel can subtract from each other not only numbers, but also dates. The fundamental difference between the two dates will be the number of days between them. But if we want to determine the precise number of months, years or just months indiscriminately years, it would be quite difficult. Fortunately, we have a hidden function DATEDIF. It is really a hidden, in the Function Wizard you will not find it. Read this manual how to use it and try to do\u00a0the example below. If this guide has helped you, become a fan on <a href=\"http:\/\/www.facebook.com\/itlektorcz\" target=\"_blank\" rel=\"noopener\">Facebook<\/a> and recommend this site to your friends, it\u00a0can be useful for them too.<\/p>\n<h2 style=\"text-align: justify;\">Function\u00a0DATEDIF<\/h2>\n<p>NOTE: You must enter DATEDIF to the cell through manual entry. After writing it is possible to activate the\u00a0function wizard by\u00a0<em><strong>fx<\/strong><\/em> button in the formula bar, but no help for the function is there.<\/p>\n<p>=DATEDIF(date 1; date 1; interval)<\/p>\n<ul>\n<li>date 1\u00a0&#8230; date cell, which must be less than the date 2<\/li>\n<li>date 2 &#8230; date cell, which must be greater\u00a0than the date\u00a01<\/li>\n<li>interval &#8230;\u00a0label identifying the type of period is to be calculated (days, months, etc.). See the table below<\/li>\n<\/ul>\n<table width=\"100%\">\n<thead>\n<tr>\n<th>Interval<\/th>\n<th>Meaning<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>m<\/td>\n<td>Months<\/td>\n<td>Complete calendar months between the dates.<\/td>\n<\/tr>\n<tr>\n<td>d<\/td>\n<td>Days<\/td>\n<td>Number of days between the dates.<\/td>\n<\/tr>\n<tr>\n<td>y<\/td>\n<td>Years<\/td>\n<td>Complete calendar years between the dates.<\/td>\n<\/tr>\n<tr>\n<td width=\"51\">ym<\/td>\n<td width=\"204\">Months Excluding Years<\/td>\n<td width=\"350\">Complete calendar months between the dates as if they were of the same year.<\/td>\n<\/tr>\n<tr>\n<td>yd<\/td>\n<td>Days Excluding Years<\/td>\n<td>Complete calendar days between the dates as if they were of the same year.<\/td>\n<\/tr>\n<tr>\n<td>md<\/td>\n<td>Days Excluding Years And Months<\/td>\n<td>Complete calendar days between the dates as if they were of the same month and same year.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"text-align: justify;\">Why is this a hidden feature? Who knows, but probably it remained in Excel for backward compatibility with older versions. And that may be the reason that the function can falsify the result of months or years, especially at the extremes of dates, which are on the border between months.<\/p>\n<h2>Example<\/h2>\n<p>To understand the function look at the following example.<\/p>\n<ul>\n<li>Cell\u00a0A1 &#8230; 10.2.2014<\/li>\n<li>Cell\u00a0B1 &#8230; 10.2.2016\n<ul>\n<li>=DATEDIF(A1;B1;&#8221;d&#8221;) &#8230; number of days between dates, result<strong>\u00a0730<\/strong><\/li>\n<li>=DATEDIF(A1;B1;&#8221;m&#8221;)\u00a0&#8230; number of\u00a0months\u00a0between dates, result<strong>\u00a024<\/strong><\/li>\n<li>=DATEDIF(A1;B1;&#8221;y&#8221;) &#8230; number of years\u00a0between dates, result<strong>\u00a02<\/strong><\/li>\n<li>=DATEDIF(A1;B1;&#8221;ym&#8221;) &#8230; number of\u00a0months\u00a0between dates, as they would be in the same year, result<strong>\u00a00<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>See more date functions here <a href=\"https:\/\/www.itlektor.cz\/en\/microsoft-excel\/useful-date-functions\/\">Useful date functions<\/a>.<\/p>\n<p><figure id=\"attachment_4444\" aria-describedby=\"caption-attachment-4444\" style=\"width: 810px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.itlektor.cz\/wp-content\/uploads\/2016\/02\/datedif.png\"><img decoding=\"async\" class=\"size-full wp-image-4444\" src=\"https:\/\/www.itlektor.cz\/wp-content\/uploads\/2016\/02\/datedif.png\" alt=\"Funkce Datedif\" width=\"810\" height=\"392\" title=\"\" srcset=\"https:\/\/www.itlektor.cz\/wp-content\/uploads\/2016\/02\/datedif.png 810w, https:\/\/www.itlektor.cz\/wp-content\/uploads\/2016\/02\/datedif-300x145.png 300w, https:\/\/www.itlektor.cz\/wp-content\/uploads\/2016\/02\/datedif-24x12.png 24w, https:\/\/www.itlektor.cz\/wp-content\/uploads\/2016\/02\/datedif-36x17.png 36w, https:\/\/www.itlektor.cz\/wp-content\/uploads\/2016\/02\/datedif-48x23.png 48w\" sizes=\"(max-width: 810px) 100vw, 810px\" \/><\/a><figcaption id=\"caption-attachment-4444\" class=\"wp-caption-text\">Funkce Datedif<\/figcaption><\/figure><\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>You may know that Excel can subtract from each other not only numbers, but also dates. The fundamental difference between the two dates will be the number of days between them. But if we want to determine the precise number of months, years or just months indiscriminately years, it would be quite difficult. Fortunately, we [&hellip;]<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":4444,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[3],"tags":[10,49,58,50],"_links":{"self":[{"href":"https:\/\/www.itlektor.cz\/en\/wp-json\/wp\/v2\/posts\/4441"}],"collection":[{"href":"https:\/\/www.itlektor.cz\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itlektor.cz\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itlektor.cz\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itlektor.cz\/en\/wp-json\/wp\/v2\/comments?post=4441"}],"version-history":[{"count":0,"href":"https:\/\/www.itlektor.cz\/en\/wp-json\/wp\/v2\/posts\/4441\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.itlektor.cz\/en\/wp-json\/wp\/v2\/media\/4444"}],"wp:attachment":[{"href":"https:\/\/www.itlektor.cz\/en\/wp-json\/wp\/v2\/media?parent=4441"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itlektor.cz\/en\/wp-json\/wp\/v2\/categories?post=4441"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itlektor.cz\/en\/wp-json\/wp\/v2\/tags?post=4441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}