{"id":57,"date":"2026-02-24T08:32:36","date_gmt":"2026-02-24T08:32:36","guid":{"rendered":"https:\/\/gigz.pk\/excel\/?post_type=lesson&#038;p=57"},"modified":"2026-03-07T04:45:24","modified_gmt":"2026-03-07T04:45:24","slug":"datedif","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/excel\/lesson\/datedif\/","title":{"rendered":"DATEDIF"},"content":{"rendered":"\n<p>The <strong>DATEDIF<\/strong> function is used to calculate the difference between two dates. It can return the difference in years, months, or days.<\/p>\n\n\n\n<p>It is commonly used for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Age calculation<\/li>\n\n\n\n<li>Service duration<\/li>\n\n\n\n<li>Project timelines<\/li>\n\n\n\n<li>Contract periods<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Structure of DATEDIF<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">=DATEDIF(start_date, end_date, unit)<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Arguments:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>start_date<\/strong> \u2192 Beginning date<\/li>\n\n\n\n<li><strong>end_date<\/strong> \u2192 Ending date<\/li>\n\n\n\n<li><strong>unit<\/strong> \u2192 Type of difference to calculate<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Units Used in DATEDIF<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Unit<\/th><th>Meaning<\/th><\/tr><\/thead><tbody><tr><td>&#8220;Y&#8221;<\/td><td>Complete years<\/td><\/tr><tr><td>&#8220;M&#8221;<\/td><td>Complete months<\/td><\/tr><tr><td>&#8220;D&#8221;<\/td><td>Total days<\/td><\/tr><tr><td>&#8220;YM&#8221;<\/td><td>Months ignoring years<\/td><\/tr><tr><td>&#8220;YD&#8221;<\/td><td>Days ignoring years<\/td><\/tr><tr><td>&#8220;MD&#8221;<\/td><td>Days ignoring months and years<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Example 1: Calculate Age (Years)<\/h2>\n\n\n\n<p>If Date of Birth is in A1:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">=DATEDIF(A1, TODAY(), \"Y\")<\/pre>\n\n\n\n<p>This calculates complete years (age).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example 2: Calculate Total Months<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">=DATEDIF(A1, TODAY(), \"M\")<\/pre>\n\n\n\n<p>Returns total completed months.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example 3: Calculate Total Days<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">=DATEDIF(A1, TODAY(), \"D\")<\/pre>\n\n\n\n<p>Returns total number of days between two dates.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example 4: Detailed Age (Years, Months, Days)<\/h2>\n\n\n\n<p>You can combine formulas:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">=DATEDIF(A1, TODAY(), \"Y\") &amp; \" Years, \" &amp;<br>DATEDIF(A1, TODAY(), \"YM\") &amp; \" Months, \" &amp;<br>DATEDIF(A1, TODAY(), \"MD\") &amp; \" Days\"<\/pre>\n\n\n\n<p>This gives a complete age breakdown.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Important Notes<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Start date must be earlier than end date.<\/li>\n\n\n\n<li>DATEDIF is a hidden function (not listed in suggestions).<\/li>\n\n\n\n<li>Dates must be valid Excel dates (not text).<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Why DATEDIF is Important<\/h2>\n\n\n\n<p>It helps you:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Calculate age accurately<\/li>\n\n\n\n<li>Measure employee experience<\/li>\n\n\n\n<li>Track project durations<\/li>\n\n\n\n<li>Manage deadlines<\/li>\n\n\n\n<li>Analyze time-based data<\/li>\n<\/ul>\n\n\n\n<p>The DATEDIF function is a powerful tool for calculating date differences in Excel efficiently and accurately.<\/p>\n\n\n<div class=\"yoast-breadcrumbs\"><span><span><a href=\"https:\/\/gigz.pk\/excel\/\">Home<\/a><\/span> \u00bb <span class=\"breadcrumb_last\" aria-current=\"page\">Excel Essential Functions (EEF) > Date &#038; Time Functions > DATEDIF<\/span><\/span><\/div>\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1772858560359\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n","protected":false},"menu_order":28,"template":"","class_list":["post-57","lesson","type-lesson","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>DATEDIF - Learn Excel the Right Way.<\/title>\n<meta name=\"description\" content=\"Learn how to use Excel\u2019s DATEDIF function to calculate date differences for age, service duration, or project timelines accurately.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gigz.pk\/excel\/lesson\/datedif\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"DATEDIF - Learn Excel the Right Way.\" \/>\n<meta property=\"og:description\" content=\"Learn how to use Excel\u2019s DATEDIF function to calculate date differences for age, service duration, or project timelines accurately.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/excel\/lesson\/datedif\/\" \/>\n<meta property=\"og:site_name\" content=\"Learn Excel the Right Way.\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-07T04:45:24+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/gigz.pk\\\/excel\\\/lesson\\\/datedif\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/excel\\\/lesson\\\/datedif\\\/\",\"name\":\"DATEDIF - Learn Excel the Right Way.\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/excel\\\/#website\"},\"datePublished\":\"2026-02-24T08:32:36+00:00\",\"dateModified\":\"2026-03-07T04:45:24+00:00\",\"description\":\"Learn how to use Excel\u2019s DATEDIF function to calculate date differences for age, service duration, or project timelines accurately.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/excel\\\/lesson\\\/datedif\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/excel\\\/lesson\\\/datedif\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/excel\\\/lesson\\\/datedif\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/excel\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Excel Essential Functions (EEF) > Date & Time Functions > DATEDIF\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/excel\\\/#website\",\"url\":\"https:\\\/\\\/gigz.pk\\\/excel\\\/\",\"name\":\"Learn Excel the Right Way.\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gigz.pk\\\/excel\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"DATEDIF - Learn Excel the Right Way.","description":"Learn how to use Excel\u2019s DATEDIF function to calculate date differences for age, service duration, or project timelines accurately.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/gigz.pk\/excel\/lesson\/datedif\/","og_locale":"en_US","og_type":"article","og_title":"DATEDIF - Learn Excel the Right Way.","og_description":"Learn how to use Excel\u2019s DATEDIF function to calculate date differences for age, service duration, or project timelines accurately.","og_url":"https:\/\/gigz.pk\/excel\/lesson\/datedif\/","og_site_name":"Learn Excel the Right Way.","article_modified_time":"2026-03-07T04:45:24+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["WebPage","FAQPage"],"@id":"https:\/\/gigz.pk\/excel\/lesson\/datedif\/","url":"https:\/\/gigz.pk\/excel\/lesson\/datedif\/","name":"DATEDIF - Learn Excel the Right Way.","isPartOf":{"@id":"https:\/\/gigz.pk\/excel\/#website"},"datePublished":"2026-02-24T08:32:36+00:00","dateModified":"2026-03-07T04:45:24+00:00","description":"Learn how to use Excel\u2019s DATEDIF function to calculate date differences for age, service duration, or project timelines accurately.","breadcrumb":{"@id":"https:\/\/gigz.pk\/excel\/lesson\/datedif\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/excel\/lesson\/datedif\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/excel\/lesson\/datedif\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/excel\/"},{"@type":"ListItem","position":2,"name":"Excel Essential Functions (EEF) > Date & Time Functions > DATEDIF"}]},{"@type":"WebSite","@id":"https:\/\/gigz.pk\/excel\/#website","url":"https:\/\/gigz.pk\/excel\/","name":"Learn Excel the Right Way.","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gigz.pk\/excel\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/gigz.pk\/excel\/wp-json\/wp\/v2\/lesson\/57","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gigz.pk\/excel\/wp-json\/wp\/v2\/lesson"}],"about":[{"href":"https:\/\/gigz.pk\/excel\/wp-json\/wp\/v2\/types\/lesson"}],"wp:attachment":[{"href":"https:\/\/gigz.pk\/excel\/wp-json\/wp\/v2\/media?parent=57"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}