{"id":1383,"date":"2024-12-02T04:49:14","date_gmt":"2024-12-02T04:49:14","guid":{"rendered":"https:\/\/blog.ezworkapp.com\/index.php\/2024\/12\/02\/ham-datedif-tinh-khoang-thoi-gian-giua-2-thoi-diem-trong-excel\/"},"modified":"2024-12-02T04:49:14","modified_gmt":"2024-12-02T04:49:14","slug":"ham-datedif-tinh-khoang-thoi-gian-giua-2-thoi-diem-trong-excel","status":"publish","type":"post","link":"https:\/\/blog.ezworkapp.com\/index.php\/2024\/12\/02\/ham-datedif-tinh-khoang-thoi-gian-giua-2-thoi-diem-trong-excel\/","title":{"rendered":"H\u00e0m DATEDIF, t\u00ednh kho\u1ea3ng th\u1eddi gian gi\u1eefa 2 th\u1eddi \u0111i\u1ec3m trong Excel"},"content":{"rendered":"<div class=\"uk-panel uk-margin\" id=\"template-nJy84WMn#1\">\n<p>\u0110\u00f4i khi, trong qu\u00e1 tr\u00ecnh l\u00e0m vi\u1ec7c v\u1edbi d\u1eef li\u1ec7u ng\u00e0y th\u00e1ng \u1edf trong Excel, ch\u00fang ta c\u1ea7n t\u00ednh kho\u1ea3ng th\u1eddi gian gi\u1eefa hai th\u1eddi \u0111i\u1ec3m. B\u00e0i vi\u1ebft n\u00e0y <a href=\"http:\/\/blog.ezworkapp.com\/\"><strong>H\u1ecdc Excel Online<\/strong><\/a> s\u1ebd chia s\u1ebb cho c\u00e1c b\u1ea1n v\u1ec1 vi\u1ec7c s\u1eed d\u1ee5ng h\u00e0m <strong><code class=\"highlighter-rouge\">DATEDIF<\/code><\/strong> k\u1ebft h\u1ee3p v\u1edbi 1 s\u1ed1 k\u00ed thu\u1eadt kh\u00e1c \u0111\u1ec3 \u0111\u1ea1t \u0111\u01b0\u1ee3c k\u1ebft qu\u1ea3 n\u00e0y. \u0110\u1ea7u ti\u00ean l\u00e0 b\u1ea3ng t\u00ednh Excel Online c\u1ee7a ch\u00fang ta \u0111\u00e3 ch\u1ee9a h\u1ea7u h\u1ebft c\u00e1c th\u00f4ng tin v\u1ec1 b\u00e0i vi\u1ebft h\u00f4m nay.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_61 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<p class=\"ez-toc-title\">Xem nhanh<\/p>\n<p><label for=\"ez-toc-cssicon-toggle-item-674d3c492d594\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><\/span><\/span><\/label><\/p>\n<nav>\n<ul class=\"ez-toc-list ez-toc-list-level-1 \">\n<li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/blog.hocexcel.online\/tinh-khoang-thoi-gian-giua-2-thoi-diem-ham-datedif-trong-excel.html#Cu_phap_ham_DATEIF\" title=\"C\u00fa ph\u00e1p h\u00e0m DATEIF\">C\u00fa ph\u00e1p h\u00e0m DATEIF<\/a><\/li>\n<li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/blog.hocexcel.online\/tinh-khoang-thoi-gian-giua-2-thoi-diem-ham-datedif-trong-excel.html#Tinh_so_gio_giua_hai_thoi_diem_trong_Excel_bang_ham_datedif\" title=\"T\u00ednh s\u1ed1 gi\u1edd gi\u1eefa hai th\u1eddi \u0111i\u1ec3m trong Excel b\u1eb1ng h\u00e0m datedif\">T\u00ednh s\u1ed1 gi\u1edd gi\u1eefa hai th\u1eddi \u0111i\u1ec3m trong Excel b\u1eb1ng h\u00e0m datedif<\/a><\/li>\n<li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/blog.hocexcel.online\/tinh-khoang-thoi-gian-giua-2-thoi-diem-ham-datedif-trong-excel.html#Tinh_so_phut_hai_thoi_diem_trong_Excel_voi_ham_datedif\" title=\"T\u00ednh s\u1ed1 ph\u00fat hai th\u1eddi \u0111i\u1ec3m trong Excel v\u1edbi h\u00e0m datedif\">T\u00ednh s\u1ed1 ph\u00fat hai th\u1eddi \u0111i\u1ec3m trong Excel v\u1edbi h\u00e0m datedif<\/a><\/li>\n<li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/blog.hocexcel.online\/tinh-khoang-thoi-gian-giua-2-thoi-diem-ham-datedif-trong-excel.html#Tinh_so_gio_giay_giua_hai_thoi_diem_trong_Excel\" title=\"T\u00ednh s\u1ed1 gi\u1edd gi\u00e2y gi\u1eefa hai th\u1eddi \u0111i\u1ec3m trong Excel\">T\u00ednh s\u1ed1 gi\u1edd gi\u00e2y gi\u1eefa hai th\u1eddi \u0111i\u1ec3m trong Excel<\/a><\/li>\n<li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/blog.hocexcel.online\/tinh-khoang-thoi-gian-giua-2-thoi-diem-ham-datedif-trong-excel.html#Tinh_so_nam_giua_hai_thoi_diem_trong_Excel\" title=\"T\u00ednh s\u1ed1 n\u0103m gi\u1eefa hai th\u1eddi \u0111i\u1ec3m trong Excel\">T\u00ednh s\u1ed1 n\u0103m gi\u1eefa hai th\u1eddi \u0111i\u1ec3m trong Excel<\/a><\/li>\n<li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/blog.hocexcel.online\/tinh-khoang-thoi-gian-giua-2-thoi-diem-ham-datedif-trong-excel.html#Tinh_so_thang_giua_hai_thoi_diem_trong_Excel\" title=\"T\u00ednh s\u1ed1 th\u00e1ng gi\u1eefa hai th\u1eddi \u0111i\u1ec3m trong Excel\">T\u00ednh s\u1ed1 th\u00e1ng gi\u1eefa hai th\u1eddi \u0111i\u1ec3m trong Excel<\/a><\/li>\n<li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/blog.hocexcel.online\/tinh-khoang-thoi-gian-giua-2-thoi-diem-ham-datedif-trong-excel.html#Tinh_so_ngay_giua_hai_thoi_diem_trong_Excel_voi_ham_datedif\" title=\"T\u00ednh s\u1ed1 ng\u00e0y gi\u1eefa hai th\u1eddi \u0111i\u1ec3m trong Excel v\u1edbi h\u00e0m datedif\">T\u00ednh s\u1ed1 ng\u00e0y gi\u1eefa hai th\u1eddi \u0111i\u1ec3m trong Excel v\u1edbi h\u00e0m datedif<\/a><\/li>\n<li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/blog.hocexcel.online\/tinh-khoang-thoi-gian-giua-2-thoi-diem-ham-datedif-trong-excel.html#Tinh_thoi_gian_tong_hop_ra_nam_thang_gio_phut_giay_giua_2_thoi_diem_ham_datedif\" title=\"T\u00ednh th\u1eddi gian t\u1ed5ng h\u1ee3p ra n\u0103m, th\u00e1ng, gi\u1edd, ph\u00fat, gi\u00e2y gi\u1eefa 2 th\u1eddi \u0111i\u1ec3m h\u00e0m datedif\">T\u00ednh th\u1eddi gian t\u1ed5ng h\u1ee3p ra n\u0103m, th\u00e1ng, gi\u1edd, ph\u00fat, gi\u00e2y gi\u1eefa 2 th\u1eddi \u0111i\u1ec3m h\u00e0m datedif<\/a><\/li>\n<li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/blog.hocexcel.online\/tinh-khoang-thoi-gian-giua-2-thoi-diem-ham-datedif-trong-excel.html#Su_dung_ham_TEXT_de_dinh_dang_thoi_gian\" title=\"S\u1eed d\u1ee5ng h\u00e0m TEXT \u0111\u1ec3 \u0111\u1ecbnh d\u1ea1ng th\u1eddi gian\">S\u1eed d\u1ee5ng h\u00e0m TEXT \u0111\u1ec3 \u0111\u1ecbnh d\u1ea1ng th\u1eddi gian<\/a><\/li>\n<li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/blog.hocexcel.online\/tinh-khoang-thoi-gian-giua-2-thoi-diem-ham-datedif-trong-excel.html#Tinh_so_ngay_tu_ngay_bat_dau_toi_ngay_ket_thuc\" title=\"T\u00ednh s\u1ed1 ng\u00e0y t\u1eeb ng\u00e0y b\u1eaft\u00a0\u0111\u1ea7u t\u1edbi ng\u00e0y k\u1ebft th\u00fac\">T\u00ednh s\u1ed1 ng\u00e0y t\u1eeb ng\u00e0y b\u1eaft\u00a0\u0111\u1ea7u t\u1edbi ng\u00e0y k\u1ebft th\u00fac<\/a><\/li>\n<li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/blog.hocexcel.online\/tinh-khoang-thoi-gian-giua-2-thoi-diem-ham-datedif-trong-excel.html#Tinh_so_tuan_giua_hai_ngay\" title=\"T\u00ednh s\u1ed1 tu\u1ea7n gi\u1eefa hai ng\u00e0y\">T\u00ednh s\u1ed1 tu\u1ea7n gi\u1eefa hai ng\u00e0y<\/a><\/li>\n<li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/blog.hocexcel.online\/tinh-khoang-thoi-gian-giua-2-thoi-diem-ham-datedif-trong-excel.html#Tinh_so_thang_giua_hai_ngay\" title=\"T\u00ednh s\u1ed1 th\u00e1ng gi\u1eefa hai ng\u00e0y\">T\u00ednh s\u1ed1 th\u00e1ng gi\u1eefa hai ng\u00e0y<\/a><\/li>\n<li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/blog.hocexcel.online\/tinh-khoang-thoi-gian-giua-2-thoi-diem-ham-datedif-trong-excel.html#Tinh_so_nam_giua_hai_ngay\" title=\"T\u00ednh s\u1ed1 n\u0103m\u00a0gi\u1eefa hai ng\u00e0y\">T\u00ednh s\u1ed1 n\u0103m\u00a0gi\u1eefa hai ng\u00e0y<\/a><\/li>\n<li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/blog.hocexcel.online\/tinh-khoang-thoi-gian-giua-2-thoi-diem-ham-datedif-trong-excel.html#Tinh_so_thang_le_ngoai_cac_nam_tron\" title=\"T\u00ednh s\u1ed1 th\u00e1ng l\u1ebb ngo\u00e0i c\u00e1c n\u0103m tr\u00f2n\">T\u00ednh s\u1ed1 th\u00e1ng l\u1ebb ngo\u00e0i c\u00e1c n\u0103m tr\u00f2n<\/a><\/li>\n<\/ul>\n<\/nav>\n<\/div>\n<h2 id=\"subqmenu1\"><span class=\"ez-toc-section\" id=\"Cu_phap_ham_DATEIF\"><\/span>C\u00fa ph\u00e1p h\u00e0m DATEIF<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>C\u00fa ph\u00e1p h\u00e0m DATEIF: <code class=\"excel-formula-inline\"><strong>=<strong class=\"ocpLegacyBold\">DATEDIF<\/strong>(<strong class=\"ocpLegacyBold\">start_date<\/strong>,<strong class=\"ocpLegacyBold\">end_date<\/strong>,<strong class=\"ocpLegacyBold\">unit<\/strong>)<\/strong><\/code><\/p>\n<p><strong>Trong \u0111\u00f3:<\/strong><\/p>\n<ul>\n<li><strong><strong class=\"ocpLegacyBold\">Start_date<\/strong><\/strong>: L\u00e0 ng\u00e0y th\u00e1ng \u0111\u1ea7u ti\u00ean ho\u1eb7c ng\u00e0y b\u1eaft \u0111\u1ea7u c\u1ee7a m\u1ed9t kho\u1ea3ng th\u1eddi gian \u0111\u00e3 cho.<\/li>\n<li><strong><strong class=\"ocpLegacyBold\">End_date<\/strong><\/strong>: L\u00e0 ng\u00e0y cu\u1ed1i c\u00f9ng ho\u1eb7c ng\u00e0y k\u1ebft th\u00fac kho\u1ea3ng th\u1eddi gian.<\/li>\n<li><strong>Unit<\/strong>: L\u00e0 gi\u00e1 tr\u1ecb th\u00f4ng tin mu\u1ed1n tr\u1ea3 v\u1ec1.<\/li>\n<\/ul>\n<p style=\"text-align: center\"><\/p>\n<blockquote>\n<p>Gi\u1ea3 s\u1eed ch\u00fang ta c\u00f3 2 m\u1ed1c th\u1eddi gian l\u00e0 <strong><code class=\"highlighter-rouge\">7\/14\/2010 10:35:15<\/code><\/strong> v\u00e0 <strong><code class=\"highlighter-rouge\">6\/9\/2015 15:30:00<\/code><\/strong> \u0111\u01b0\u1ee3c l\u01b0u \u1edf l\u1ea7n l\u01b0\u1ee3t \u00f4 <strong><code class=\"highlighter-rouge\">A2<\/code><\/strong> v\u00e0<strong><code class=\"highlighter-rouge\">B2<\/code><\/strong>.<\/p>\n<\/blockquote>\n<p>D\u01b0\u1edbi \u0111\u00e2y l\u00e0 nh\u1eefng v\u00ed d\u1ee5 c\u1ee5 th\u1ec3 \u0111\u1ec3 b\u1ea1n hi\u1ec3u h\u01a1n v\u1ec1 h\u00e0m Dateif nh\u00e9!<\/p>\n<h2 id=\"tnh-s-gi-gia-hai-thi-im-trong-excel\"><span class=\"ez-toc-section\" id=\"Tinh_so_gio_giua_hai_thoi_diem_trong_Excel_bang_ham_datedif\"><\/span>T\u00ednh s\u1ed1 gi\u1edd gi\u1eefa hai th\u1eddi \u0111i\u1ec3m trong Excel b\u1eb1ng h\u00e0m datedif<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u0110\u1ec3 t\u00ednh s\u1ed1 gi\u1edd gi\u1eefa hai th\u1eddi \u0111i\u1ec3m tr\u00ean ch\u00fang ta s\u1eed d\u1ee5ng c\u00f4ng th\u1ee9c sau:<\/p>\n<p><strong><code class=\"highlighter-rouge\">=INT((B2-A2)*24)<\/code><\/strong><\/p>\n<div class=\"code-block code-block-1\" style=\"margin: 8px 0;clear: both\">\n<div class=\"ad-inserterpro\">\n<a href=\"https:\/\/hocexcel.online\/course\/preview\/ex101-excel-tu-co-ban-den-chuyen-gia-danh-cho-nguoi-di-lam\"><br \/>\n<img decoding=\"async\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/ex101_92019-nho-99.gif\" title=\"ex101_92019-nho-99\"><br \/>\n<\/a>\n<\/div>\n<\/div>\n<p>v\u00e0 nh\u1eadn \u0111\u01b0\u1ee3c k\u1ebft qu\u1ea3 l\u00e0 <strong><code class=\"highlighter-rouge\">42988<\/code><\/strong><\/p>\n<p>ho\u1eb7c<\/p>\n<p><strong>=DAY(ABS(B2-A2))*24*60 + HOUR(ABS(B2-A2))<\/strong><\/p>\n<p>Xem th\u00eam: T\u1ed5ng h\u1ee3p c\u00e1c ki\u1ebfn th\u1ee9c v\u1ec1 <a href=\"http:\/\/blog.ezworkapp.com\/excel-nang-cao\">Excel n\u00e2ng cao<\/a><\/p>\n<h2 id=\"tnh-s-pht-hai-thi-im-trong-excel\"><span class=\"ez-toc-section\" id=\"Tinh_so_phut_hai_thoi_diem_trong_Excel_voi_ham_datedif\"><\/span>T\u00ednh s\u1ed1 ph\u00fat hai th\u1eddi \u0111i\u1ec3m trong Excel v\u1edbi h\u00e0m datedif<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u0110\u1ec3 t\u00ednh s\u1ed1 ph\u00fat gi\u1eefa hai th\u1eddi \u0111i\u1ec3m tr\u00ean ch\u00fang ta s\u1eed d\u1ee5ng c\u00f4ng th\u1ee9c sau:<\/p>\n<p><strong><code class=\"highlighter-rouge\">=INT((B2-A2)*24*60)<\/code><\/strong><\/p>\n<p>v\u00e0 nh\u1eadn \u0111\u01b0\u1ee3c k\u1ebft qu\u1ea3 l\u00e0 <strong><code class=\"highlighter-rouge\">2579334<\/code><\/strong><\/p>\n<p>Ho\u1eb7c<\/p>\n<p><strong><code class=\"excel-formula-inline\">=DAY(ABS(B2-A2))*24*60 + HOUR(ABS(B2-A2))*60 + MINUTE(ABS(B2-A2))<\/code><\/strong><\/p>\n<h2 id=\"tnh-s-gi-giy-gia-hai-thi-im-trong-excel\"><span class=\"ez-toc-section\" id=\"Tinh_so_gio_giay_giua_hai_thoi_diem_trong_Excel\"><\/span>T\u00ednh s\u1ed1 gi\u1edd gi\u00e2y gi\u1eefa hai th\u1eddi \u0111i\u1ec3m trong Excel<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u0110\u1ec3 t\u00ednh s\u1ed1 gi\u00e2y gi\u1eefa hai th\u1eddi \u0111i\u1ec3m tr\u00ean ch\u00fang ta s\u1eed d\u1ee5ng c\u00f4ng th\u1ee9c sau:<\/p>\n<p><strong><code class=\"highlighter-rouge\">=INT((B2-A2)*24*60*60)<\/code><\/strong><\/p>\n<p>v\u00e0 nh\u1eadn \u0111\u01b0\u1ee3c k\u1ebft qu\u1ea3 l\u00e0 <strong><code class=\"highlighter-rouge\">154760085<\/code><\/strong><\/p>\n<p>Xem th\u00eam: <strong>C\u00e1ch <\/strong><a href=\"http:\/\/blog.ezworkapp.com\/cach-tinh-thoi-gian-trong-excel-chenh-lech-thoi-gian-cong-tru-thoi-gian.html\"><strong>C\u1ed9ng tr\u1eeb th\u1eddi gian trong Excel<\/strong><\/a><\/p>\n<h2 id=\"tnh-s-nm-gia-hai-thi-im-trong-excel\"><span class=\"ez-toc-section\" id=\"Tinh_so_nam_giua_hai_thoi_diem_trong_Excel\"><\/span>T\u00ednh s\u1ed1 n\u0103m gi\u1eefa hai th\u1eddi \u0111i\u1ec3m trong Excel<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u0110\u1ec3 t\u00ednh s\u1ed1 n\u0103m gi\u1eefa hai th\u1eddi \u0111i\u1ec3m tr\u00ean ch\u00fang ta s\u1eed d\u1ee5ng c\u00f4ng th\u1ee9c sau:<\/p>\n<p><strong><code class=\"highlighter-rouge\">=DATEDIF(A2,B2,\"y\")<\/code><\/strong><\/p>\n<p>v\u00e0 nh\u1eadn \u0111\u01b0\u1ee3c k\u1ebft qu\u1ea3 l\u00e0 <strong><code class=\"highlighter-rouge\">4<\/code><\/strong><\/p>\n<p>Xem th\u00eam: <a href=\"http:\/\/blog.ezworkapp.com\/cach-cong-tru-ngay-thang-nam-trong-excel.html\">C\u00e1ch c\u1ed9ng tr\u1eeb ng\u00e0y, th\u00e1ng, n\u0103m trong Excel<\/a><\/p>\n<h2 id=\"tnh-s-thng-gia-hai-thi-im-trong-excel\"><span class=\"ez-toc-section\" id=\"Tinh_so_thang_giua_hai_thoi_diem_trong_Excel\"><\/span>T\u00ednh s\u1ed1 th\u00e1ng gi\u1eefa hai th\u1eddi \u0111i\u1ec3m trong Excel<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u0110\u1ec3 t\u00ednh s\u1ed1 th\u00e1ng gi\u1eefa hai th\u1eddi \u0111i\u1ec3m tr\u00ean ch\u00fang ta s\u1eed d\u1ee5ng c\u00f4ng th\u1ee9c sau:<\/p>\n<p><strong><code class=\"highlighter-rouge\">=DATEDIF(A2,B2,\"m\")<\/code><\/strong><\/p>\n<p>v\u00e0 nh\u1eadn \u0111\u01b0\u1ee3c k\u1ebft qu\u1ea3 l\u00e0 <strong><code class=\"highlighter-rouge\">58<\/code><\/strong><\/p>\n<p>Xem th\u00eam: <strong>C\u00e1ch c\u1ed9ng ng\u00e0y, <a href=\"http:\/\/blog.ezworkapp.com\/cach-cong-tru-ngay-thang-nam-trong-excel.html\">c\u00e1ch c\u1ed9ng th\u00e1ng rong Excel<\/a><\/strong><\/p>\n<h2 id=\"tnh-s-ngy-gia-hai-thi-im-trong-excel\"><span class=\"ez-toc-section\" id=\"Tinh_so_ngay_giua_hai_thoi_diem_trong_Excel_voi_ham_datedif\"><\/span>T\u00ednh s\u1ed1 ng\u00e0y gi\u1eefa hai th\u1eddi \u0111i\u1ec3m trong Excel v\u1edbi h\u00e0m datedif<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u0110\u1ec3 t\u00ednh s\u1ed1 ng\u00e0y gi\u1eefa hai th\u1eddi \u0111i\u1ec3m tr\u00ean ch\u00fang ta s\u1eed d\u1ee5ng<strong> h\u00e0m datedif<\/strong> v\u1edbi c\u00f4ng th\u1ee9c sau:<\/p>\n<p><strong><code class=\"highlighter-rouge\">=DATEDIF(A2,B2,\"d\")<\/code><\/strong><\/p>\n<p>v\u00e0 nh\u1eadn \u0111\u01b0\u1ee3c k\u1ebft qu\u1ea3 l\u00e0 <strong><code class=\"highlighter-rouge\">1791<\/code><\/strong><\/p>\n<blockquote>\n<p>Tr\u01b0\u1edbc khi chia s\u1ebb m\u1ed9t c\u00f4ng th\u1ee9c t\u1ed5ng qu\u00e1t cho m\u1ecdi tr\u01b0\u1eddng h\u1ee3p b\u1ea1n c\u00f3 th\u1ec3 ngh\u0129 \u0111\u1ebfn, xin h\u00e3y chia s\u1ebb b\u00e0i vi\u1ebft n\u00e0y, s\u1ef1 chia s\u1ebb l\u00e0 ngu\u1ed3n kh\u00edch l\u1ec7 l\u1edbn nh\u1ea5t \u0111\u1ec3 trang web ti\u1ebfp t\u1ee5c nh\u1eefng b\u00e0i vi\u1ebft th\u1ebf n\u00e0y<\/p>\n<\/blockquote>\n<h2 id=\"tnh-khong-thi-gian-tng-hp-ra-nm-thng-gi-pht-giy-gia-2-thi-im\"><span class=\"ez-toc-section\" id=\"Tinh_thoi_gian_tong_hop_ra_nam_thang_gio_phut_giay_giua_2_thoi_diem_ham_datedif\"><\/span>T\u00ednh th\u1eddi gian t\u1ed5ng h\u1ee3p ra n\u0103m, th\u00e1ng, gi\u1edd, ph\u00fat, gi\u00e2y gi\u1eefa 2 th\u1eddi \u0111i\u1ec3m h\u00e0m datedif<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Ch\u00fang ta d\u00f9ng c\u00f4ng th\u1ee9c<strong> h\u00e0m datedif<\/strong> \u0111\u1ec3 th\u1ef1c hi\u1ec7n:<\/p>\n<p><strong><code class=\"highlighter-rouge\">=DATEDIF(A2,B2,\"y\")&amp;\" n\u0103m, \"&amp;DATEDIF(A2,B2,\"ym\")&amp;\" th\u00e1ng ,\"&amp;DATEDIF(A2,B2,\"md\")&amp;\" ng\u00e0y, \"&amp;TEXT(B2-A2,\"hh\")&amp;\" gi\u1edd, \"&amp;TEXT(B2-A2,\"mm\")&amp;\" ph\u00fat, \"&amp;TEXT(B2-A2,\"ss\")&amp;\" gi\u00e2y\"<\/code><\/strong><\/p>\n<p>V\u00e0 nh\u1eadn \u0111\u01b0\u1ee3c k\u1ebft qu\u1ea3 nh\u01b0 mong mu\u1ed1n:<\/p>\n<p><strong><code class=\"highlighter-rouge\">4 n\u0103m, 10 th\u00e1ng ,26 ng\u00e0y, 04 gi\u1edd, 54 ph\u00fat, 45 gi\u00e2y<\/code><\/strong><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Su_dung_ham_TEXT_de_dinh_dang_thoi_gian\"><\/span>S\u1eed d\u1ee5ng h\u00e0m TEXT \u0111\u1ec3 \u0111\u1ecbnh d\u1ea1ng th\u1eddi gian<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div>\u0110\u1ec3 s\u1eed d\u1ee5ng h\u00e0m <strong>TEXT<\/strong>, ch\u00fang ta h\u00e3y l\u00e0m quen v\u1edbi 1 s\u1ed1 quy \u01b0\u1edbc \u0111\u1ecbnh d\u1ea1ng c\u1ee7a h\u00e0m n\u00e0y.<\/div>\n<div>C\u00fa ph\u00e1p c\u1ee7a h\u00e0m <strong>TEXT<\/strong> nh\u01b0 sau:<\/div>\n<pre><code>=TEXT(&lt;gi\u00e1 tr\u1ecb c\u1ea7n \u0111\u1ecbnh d\u1ea1ng&gt;, &lt;\u0111\u1ecbnh d\u1ea1ng&gt;)<\/code><\/pre>\n<div>Tham s\u1ed1 th\u1ee9 nh\u1ea5t r\u00f5 r\u00e0ng r\u1ed3i, ch\u00fang ta mu\u1ed1n \u0111\u1ecbnh d\u1ea1ng g\u00ec th\u00ec ch\u00fang ta s\u1ebd cho v\u00e0o \u0111\u00f3. Tham s\u1ed1 th\u1ee9 2 l\u00e0 ch\u00fang ta mu\u1ed1n \u0111\u1ecbnh d\u1ea1ng nh\u01b0 th\u1ebf n\u00e0o, trong b\u00e0i n\u00e0y, ch\u00fang ta mu\u1ed1n \u0111\u1ecbnh d\u1ea1ng th\u1eddi gian. V\u1eady n\u00ean ch\u00fang ta s\u1ebd tham kh\u1ea3o 1 s\u1ed1 v\u00ed d\u1ee5 sau \u0111\u00e2y:<\/div>\n<ol>\n<li><strong>T\u00ednh s\u1ed1 gi\u1edd gi\u1eefa 2 th\u1eddi \u0111i\u1ec3m:<\/strong>\n<pre><code>=TEXT(B2-A2,\"h\")<\/code><\/pre>\n<\/li>\n<li><strong>T\u00ednh gi\u1edd v\u00e0 ph\u00fat gi\u1eefa 2 th\u1eddi \u0111i\u1ec3m:<\/strong>\n<pre><code>= TEXT(B2-A2,\"h:mm\")<\/code><\/pre>\n<\/li>\n<li><strong>T\u00ednh gi\u1edd, ph\u00fat v\u00e0 gi\u00e2y gi\u1eefa 2 th\u1eddi \u0111i\u1ec3m<\/strong>\n<pre><code>=TEXT(B2.A2, \"h:mm:ss\")\r\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>\u0110\u1ec3 c\u00e1c b\u1ea1n hi\u1ec3u h\u01a1n v\u1ec1 h\u00e0m Dateif, m\u00ecnh s\u1ebd cung c\u1ea5p cho b\u1ea1n th\u00eam m\u1ed9t v\u00ed d\u1ee5 n\u1eefa nh\u00e9!<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Tinh_so_ngay_tu_ngay_bat_dau_toi_ngay_ket_thuc\"><\/span>T\u00ednh s\u1ed1 ng\u00e0y t\u1eeb ng\u00e0y b\u1eaft\u00a0\u0111\u1ea7u t\u1edbi ng\u00e0y k\u1ebft th\u00fac<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u0110\u1ec3 t\u00ednh kho\u1ea3ng c\u00e1ch ng\u00e0y gi\u1eefa 2 th\u1eddi\u00a0\u0111i\u1ec3m: t\u1eeb ng\u00e0y b\u1eaft\u00a0\u0111\u1ea7u t\u1edbi ng\u00e0y k\u1ebft th\u00fac, ch\u00fang ta c\u00f3 2 c\u00e1ch l\u00e0m nh\u01b0 sau:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-27394\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/datedif-theo-so-ngay.png\" width=\"703\" height=\"122\" title=\"datedif-theo-so-ngay\"><\/p>\n<p><strong>C\u00e1ch 1<\/strong>: D\u00f9ng ph\u00e9p tr\u1eeb tr\u1ef1c ti\u1ebfp gi\u1eefa 2 m\u1ed1c ng\u00e0y: Ng\u00e0y k\u1ebft th\u00fac \u2013 Ng\u00e0y b\u1eaft\u00a0\u0111\u1ea7u<\/p>\n<p>K\u1ebft qu\u1ea3 gi\u1ed1ng nh\u01b0 t\u1ea1i\u00a0\u00f4 C2 trong h\u00ecnh tr\u00ean.<\/p>\n<p><strong>C\u00e1ch 2<\/strong>: S\u1eed d\u1ee5ng h\u00e0m DATEDIF theo\u00a0\u0111\u01a1n v\u1ecb t\u00ednh l\u00e0 s\u1ed1 ng\u00e0y<\/p>\n<p><strong>C\u1ea5u tr\u00fac: <code class=\"excel-formula-inline\">DATEDIF(Ng\u00e0y b\u1eaft\u00a0\u0111\u1ea7u, Ng\u00e0y k\u1ebft th\u00fac, \"d\")<\/code><\/strong><\/p>\n<p>K\u00fd hi\u1ec7u \u201cd\u201d\u00a0\u0111\u1ea1i di\u1ec7n cho Ng\u00e0y (Day)<\/p>\n<p>Ta th\u1ea5y k\u1ebft qu\u1ea3 c\u1ee7a c\u1ea3 2 c\u00e1ch t\u00ednh\u00a0\u0111\u1ec1u b\u1eb1ng nhau.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Tinh_so_tuan_giua_hai_ngay\"><\/span>T\u00ednh s\u1ed1 tu\u1ea7n gi\u1eefa hai ng\u00e0y<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>B\u1ea3n th\u00e2n h\u00e0m DATEDIF kh\u00f4ng c\u00f3\u00a0\u0111\u01a1n v\u1ecb t\u00ednh l\u00e0 Tu\u1ea7n, nh\u01b0ng d\u1ef1a v\u00e0o\u00a0\u0111\u1eb7c\u00a0\u0111i\u1ec3m: 1 tu\u1ea7n lu\u00f4n c\u00f3 7 ng\u00e0y, do\u00a0\u0111\u00f3 ta c\u00f3 th\u1ec3 l\u00e0m nh\u01b0 sau:<\/p>\n<p>L\u1ea5y k\u1ebft qu\u1ea3 h\u00e0m DATEDIF theo ng\u00e0y chia cho s\u1ed1 7<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-27395\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/datedif-theo-so-tuan.png\" width=\"702\" height=\"122\" title=\"datedif-theo-so-tuan\"><\/p>\n<p>C\u00f4ng th\u1ee9c t\u1ea1i\u00a0\u00f4 D2 cho ch\u00fang ta k\u1ebft qu\u1ea3 t\u00ednh theo s\u1ed1 tu\u1ea7n gi\u1eefa hai ng\u00e0y: T\u1eeb ng\u00e0y b\u1eaft\u00a0\u0111\u1ea7u t\u1edbi Ng\u00e0y k\u1ebft th\u00fac:<\/p>\n<p style=\"padding-left: 30px\">=DATEDIF(A2,B2,\u201dd\u201d)\/7<\/p>\n<p>\u0110\u1ec3 t\u00ednh theo tr\u00f2n s\u1ed1 tu\u1ea7n (\u0111\u1ee7 tu\u1ea7n), ch\u00fang ta s\u1ebd s\u1eed d\u1ee5ng h\u00e0m lo\u1ea1i b\u1ecf ph\u1ea7n th\u1eadp ph\u00e2n l\u00e0 h\u00e0m TRUNC ho\u1eb7c <a href=\"http:\/\/blog.ezworkapp.com\/ham-int-ham-lay-phan-nguyen-trong-excel.html\"><strong>h\u00e0m INT<\/strong><\/a><\/p>\n<p style=\"padding-left: 30px\">=TRUNC(DATEDIF(A2,B2,\u201dd\u201d)\/7, 0)<\/p>\n<p style=\"padding-left: 30px\">=INT(DATEDIF(A2,B2,\u201dd\u201d)\/7)<\/p>\n<p>Xem th\u00eam: <a href=\"http:\/\/blog.ezworkapp.com\/cach-tim-phan-nguyen-cua-phep-chia-voi-ham-quotient-va-ham-int.html\">C\u00e1ch t\u00ecm ph\u1ea7n nguy\u00ean c\u1ee7a ph\u00e9p chia v\u1edbi h\u00e0m QUOTIENT v\u00e0 h\u00e0m INT<\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Tinh_so_thang_giua_hai_ngay\"><\/span>T\u00ednh s\u1ed1 th\u00e1ng gi\u1eefa hai ng\u00e0y<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u0110\u1ec3 t\u00ednh s\u1ed1 th\u00e1ng, ch\u00fang ta s\u1eed d\u1ee5ng tham s\u1ed1 \u201cm\u201d trong h\u00e0m DATEDIF nh\u01b0 sau:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-27402\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/datedif-theo-so-thang.png\" width=\"873\" height=\"117\" title=\"datedif-theo-so-thang\"><\/p>\n<p style=\"padding-left: 30px\">=DATEDIF(Ng\u00e0y b\u1eaft\u00a0\u0111\u1ea7u, Ng\u00e0y k\u1ebft th\u00fac, \u201cm\u201d)<\/p>\n<p>S\u1ed1 th\u00e1ng\u00a0\u0111\u01b0\u1ee3c t\u00ednh trong h\u00e0m DATEDIF\u00a0tr\u00ean nguy\u00ean t\u1eafc tr\u00f2n ng\u00e0y,\u00a0\u0111\u1ee7 ng\u00e0y ch\u1ee9 kh\u00f4ng\u00a0\u0111\u01a1n thu\u1ea7n ch\u1ec9 x\u00e9t ch\u00eanh l\u1ec7ch s\u1ed1 th\u00e1ng.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Tinh_so_nam_giua_hai_ngay\"><\/span>T\u00ednh s\u1ed1 n\u0103m\u00a0gi\u1eefa hai ng\u00e0y<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u0110\u1ec3 t\u00ednh s\u1ed1 th\u00e1ng, ch\u00fang ta s\u1eed d\u1ee5ng tham s\u1ed1 \u201cy\u201d trong h\u00e0m DATEDIF nh\u01b0 sau:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-27416\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/datedif-theo-so-nam-01-1024x113-1.png\" width=\"1024\" height=\"113\" title=\"datedif-theo-so-nam-01-1024x113-1\"><\/p>\n<p>T\u1ea1i\u00a0\u00f4 F2 d\u00f9ng c\u00f4ng th\u1ee9c x\u00e1c\u00a0\u0111\u1ecbnh s\u1ed1 n\u0103m:<\/p>\n<p style=\"padding-left: 30px\">=DATEDIF(Ng\u00e0y b\u1eaft\u00a0\u0111\u1ea7u, Ng\u00e0y k\u1ebft th\u00fac, \u201cy\u201d)<\/p>\n<p>S\u1ed1 n\u0103m\u00a0\u0111\u01b0\u1ee3c t\u00ednh trong h\u00e0m DATEDIF\u00a0\u0111\u01b0\u1ee3c t\u00ednh tr\u00ean nguy\u00ean t\u1eafc\u00a0\u0111\u1ee7 ng\u00e0y.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Tinh_so_thang_le_ngoai_cac_nam_tron\"><\/span>T\u00ednh s\u1ed1 th\u00e1ng l\u1ebb ngo\u00e0i c\u00e1c n\u0103m tr\u00f2n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u0110\u1ec3 t\u00ednh s\u1ed1 th\u00e1ng l\u1ebb ngo\u00e0i s\u1ed1 n\u0103m, ta c\u00f3 th\u1ec3 t\u00ednh theo 2 c\u00e1ch:<\/p>\n<p><strong>C\u00e1ch 1<\/strong>: T\u00ednh s\u1ed1 th\u00e1ng \u2013 (S\u1ed1 n\u0103m * 12)<\/p>\n<p><strong>C\u00e1ch 2<\/strong>: S\u1eed d\u1ee5ng h\u00e0m DATEDIF v\u1edbi tham s\u1ed1 l\u00e0 \u201cym\u201d<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-27417\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/datedif-theo-so-thang-le.png\" width=\"877\" height=\"124\" title=\"datedif-theo-so-thang-le\"><\/p>\n<p>Trong\u00a0\u00f4 E2, c\u00f4ng th\u1ee9c Datedif s\u1eed d\u1ee5ng l\u00e0:<\/p>\n<p style=\"padding-left: 30px\">=DATEDIF(A2,B2,\u201dym\u201d)<\/p>\n<p>K\u1ebft qu\u1ea3: 16 th\u00e1ng = 1 n\u0103m + 4 th\u00e1ng l\u1ebb<\/p>\n<p>Hi v\u1ecdng v\u1edbi c\u00f4ng th\u1ee9c n\u00e0y, c\u00e1c b\u1ea1n c\u00f3 th\u1ec3 v\u1eadn d\u1ee5ng linh ho\u1ea1t cho c\u00f4ng vi\u1ec7c c\u1ee7a m\u00ecnh.<\/p>\n<p>\u0110\u1ec3 c\u00f3 th\u1ec3 \u1ee9ng d\u1ee5ng t\u1ed1t Excel v\u00e0o trong c\u00f4ng vi\u1ec7c, ch\u00fang ta kh\u00f4ng ch\u1ec9 n\u1eafm v\u1eefng \u0111\u01b0\u1ee3c c\u00e1c h\u00e0m m\u00e0 c\u00f2n ph\u1ea3i s\u1eed d\u1ee5ng t\u1ed1t c\u1ea3 c\u00e1c c\u00f4ng c\u1ee5 c\u1ee7a Excel. Nh\u1eefng h\u00e0m n\u00e2ng cao gi\u00fap \u00e1p d\u1ee5ng t\u1ed1t v\u00e0o c\u00f4ng vi\u1ec7c nh\u01b0 SUMIFS, COUNTIFS, SUMPRODUCT, INDEX + MATCH\u2026 Nh\u1eefng c\u00f4ng c\u1ee5 th\u01b0\u1eddng s\u1eed d\u1ee5ng l\u00e0 Data validation, Conditional formatting, Pivot table\u2026<\/p>\n<p>To\u00e0n b\u1ed9 nh\u1eefng ki\u1ebfn th\u1ee9c n\u00e0y c\u00e1c b\u1ea1n \u0111\u1ec1u c\u00f3 th\u1ec3 h\u1ecdc \u0111\u01b0\u1ee3c trong kh\u00f3a h\u1ecdc<\/p>\n<p>Xem th\u00eam: <strong><a href=\"http:\/\/blog.ezworkapp.com\/cach-cong-tru-ngay-thang-nam-trong-excel.html\">C\u00e1ch c\u1ed9ng tr\u1eeb ng\u00e0y, th\u00e1ng, n\u0103m trong Excel<\/a><\/strong><\/p>\n<\/div>\n<div class=\"uk-panel uk-margin uk-width-xlarge\">\n<p>Click \u0111\u0103ng k\u00fd h\u1ecdc t\u1ea1i:<\/p>\n<p><a href=\"http:\/\/blog.ezworkapp.com\/khoa-hoc\" target=\"_blank\" rel=\"noopener\">T\u1ea5t c\u1ea3 kho\u00e1 h\u1ecdc\u00a0<span>\ud83d\udcd6<\/span><\/a><\/p>\n<p><a href=\"http:\/\/blog.ezworkapp.com\/huong-dan-kich-hoat-khoa-hoc-tai-hoc-excel-online.html\" target=\"_blank\" rel=\"noopener\">H\u01b0\u1edbng d\u1eabn k\u00edch ho\u1ea1t<\/a><\/p>\n<p>HKD H\u1ecdc Excel Online<br \/>S\u1ed1 \u0110K: 17A80048102<\/p>\n<\/div>\n<div class=\"uk-panel uk-text-small uk-margin uk-margin-remove-bottom uk-text-center\">\n<p>\u00a9  document.currentScript.insertAdjacentHTML(&#8216;afterend&#8217;, &#8221; + new Intl.DateTimeFormat(document.documentElement.lang, {year: &#8216;numeric&#8217;}).format() + &#8221;);  H\u1ecdc Excel Online. All rights reserved.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<div class=\"ad-inserterpro\">\n<a href=\"https:\/\/hocexcel.online\/course\/preview\/ex101-excel-tu-co-ban-den-chuyen-gia-danh-cho-nguoi-di-lam\"><br \/>\n<img decoding=\"async\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/ex101_92019-nho-99.gif\"><br \/>\n<\/a>\n<\/div>\n","protected":false},"author":1,"featured_media":1384,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1383","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-excel-nang-cao"],"_links":{"self":[{"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/posts\/1383","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/comments?post=1383"}],"version-history":[{"count":0,"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/posts\/1383\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/media\/1384"}],"wp:attachment":[{"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/media?parent=1383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/categories?post=1383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/tags?post=1383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}