有小伙伴在后臺(tái)留言詢(xún)問(wèn),公歷日期如何轉(zhuǎn)為農(nóng)歷日期。
比如,下面的Excel表格,將B列的日期,轉(zhuǎn)成對(duì)應(yīng)的農(nóng)歷。
C2單元格輸入公式:=TEXT(B2,"[$-130000]yyyy-m-d"),下拉即可。[$-130000]:表示公歷轉(zhuǎn)陰歷的特殊參數(shù)。除了上面的公式寫(xiě)法,再給大家發(fā)幾個(gè)不同的格式,對(duì)應(yīng)的函數(shù)公式肯定也是不一樣的哈。可以收藏備用。
=IF(--TEXT(B2,"[$-130000]d")<11,TEXT(B2,"[$-130000][dbnum1]m月初d"),SUBSTITUTE(TEXT(B2,"[$-130000][dbnum1]m月d"),IF(--TEXT(B2,"[$-130000]d")>20,"二十",""),"廿"))=TEXT(B2,"[$-130000]yyyy年m月"&IF(LEN(--TEXT(B2,"[$-130000]dd"))=1,"初","")&"d")=TEXT(B2," [$-130000][DBNum1]m月d日")=MID(" 甲乙丙丁戊己庚辛壬癸",MOD(TEXT(B2,"[$-130000]e")-4,10)+1,1)&MID("子丑寅卯辰巳午未申酉 戌亥",MOD(TEXT(B2,"[$-130000]e")-4,12)+1,1)&"年"&IF(TEXT(B2," [$-130000]m")*1=12," 臘",IF(TEXT(B2," [$-130000]m")*1=1," 正",TEXT(B2," [$-130000][DBNum1]m")))&"月"&IF(TEXT(B2," [$-130000]d")-9<=1,"初",IF(TEXT(B2," [$-130000]d")-29>=1,"卅",IF(TEXT(B2," [$-130000]d")-19>=1,"廿","十")))&IF(RIGHT(TEXT(B2," [$-130000]d"),1)*1=0,"",TEXT(RIGHT(TEXT(B2," [$-130000]d"),1)*1,"[DBNum1]d"))&"日"=IF(TEXT(B2," [$-130000]m")*1=12," 臘",IF(TEXT(B2," [$-130000]m")*1=1," 正",TEXT(B2," [$-130000][DBNum1]m")))&"月"&IF(TEXT(B2," [$-130000]d")-9<=1,"初",IF(TEXT(B2," [$-130000]d")-29>=1,"卅",IF(TEXT(B2," [$-130000]d")-19>=1,"廿","十")))&IF(RIGHT(TEXT(B2," [$-130000]d"),1)*1=0,"",TEXT(RIGHT(TEXT(B2," [$-130000]d"),1)*1,"[DBNum1]d"))&"日"
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶(hù)發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)
點(diǎn)擊舉報(bào)。