Excel--DATEDIF函数的用法及参数含义

DATEDIF函数的用法为:

DATEDIF(start_date,end_date,unit),start_date表示的是起始时间,end_date表示的是结束时间。unit表示的是返回的时间代码,是天、月、年等。如下:

|--------|---|---|---|---|
| Datedif函数的参数含义 |||||
| unit参数 | 返回值的意义 ||||
| "y" | 两个时间段之间的整年数 ||||
| "m" | 两个时间段之间的整月数 ||||
| "d" | 两个时间段之间的天数 ||||
| "md" | 两个时间段之间的天数的差,忽略日期中的年和月 ||||
| "ym" | 两个时间段之间的月数的差,忽略日期中的年和日 ||||
| "yd" | 两个时间段之间的天数的差,忽略日期中的年和月 ||||

|-------------------------|-----------|
| 计算两个日期之间的整年数 ||
| start_date | 2007-5-23 |
| end_date | 2016-5-24 |
| 时间差 | 9 |
| 公式:DATEDIF(B27,B28,"y") |   |

|-------------------------|-----------|
| 计算两个日期之间的整月数 ||
| start_date | 2007-5-23 |
| end_date | 2016-5-24 |
| 时间差 | 108 |
| 公式:DATEDIF(B33,B34,"m") |   |

|-------------------------|-----------|
| 计算两个日期之间的整天数 ||
| start_date | 2007-5-23 |
| end_date | 2016-5-24 |
| 时间差 | 3289 |
| 公式:DATEDIF(B33,B34,"m") |   |

|--------------------------|-----------|
| 计算两个日期之间的整天数,忽略年月 ||
| start_date | 2007-1-13 |
| end_date | 2016-5-24 |
| 时间差 | 11 |
| 公式:DATEDIF(B45,B46,"md") |   |

示例如下:

相关推荐
wtsolutions2 小时前
MCP Service Integration - Excel to JSON for AI and Automation
人工智能·json·excel
wtsolutions12 小时前
JSON to Excel Add-in - Seamless Integration Within Excel
json·excel
wtsolutions13 小时前
Getting Started with JSON to Excel Web App - Convert in Seconds
json·excel·web app
wtsolutions16 小时前
Using the JSON to Excel API - Programmatic Access for Developers
json·excel
qq_4351395716 小时前
EasyExcel(FastExcel)Excel导出功能 技术文档
excel
wtsolutions19 小时前
Understanding JSON Formats - What JSON to Excel Supports
json·excel
wtsolutions20 小时前
Advanced Features - Unlocking the Power of JSON to Excel Pro
linux·json·excel
fs哆哆21 小时前
VB.NET和VBA教程-如何查找Excel数据区域边界
excel
小矮强1 天前
Excel中根据年月日提取月日,并按月日进行排序
excel
开开心心_Every1 天前
图片批量压缩工具:支持有损无损两种模式
python·游戏·微信·django·pdf·excel·语音识别