2 回答
TA貢獻(xiàn)1818條經(jīng)驗(yàn) 獲得超11個(gè)贊
datedif是一個(gè)十分方便的函數(shù),可以計(jì)算兩日期之間的天數(shù)、月數(shù)和年數(shù)
Datedif(start_date,end_date,unit)只是Excel為了沿襲Lotus123的一個(gè) 函數(shù),屬于隱藏函數(shù)
語(yǔ)法
DATEDIF(start_date,end_date,unit)
Start_date 為一個(gè)日期,它代表時(shí)間段內(nèi)的第一個(gè)日期或起始日期
End_date 為一個(gè)日期,它代表時(shí)間段內(nèi)的最后一個(gè)日期或結(jié)束日期。
Unit 為所需信息的返回類(lèi)型。
Unit 返回
"Y" 時(shí)間段中的整年數(shù)。
"M" 時(shí)間段中的整月數(shù)。
"D" 時(shí)間段中的天數(shù)。
"MD" start_date 與 end_date 日期中天數(shù)的差。忽略日期中的月和年。
"YM" start_date 與 end_date 日期中月數(shù)的差。忽略日期中的日和年。
"YD" start_date 與 end_date 日期中天數(shù)的差。忽略日期中的年
注意:start_date參數(shù)必須要比end_date參數(shù)早,否則函數(shù)返回錯(cuò)誤!
- 2 回答
- 0 關(guān)注
- 745 瀏覽
添加回答
舉報(bào)
