exce中,怎樣根據陽曆日期計算出農曆日期。用什麼函式公式?要求 無論哪年的日期都可以算。要準確

2021-05-26 22:52:57 字數 9660 閱讀 1695

1樓:匿名使用者

如果,a1=

2014/12/13

那麼,b1公式是

=text(a1,"[$-130000]yyyy-mm-dd")

如何根據陽曆日期推算出對應的陰曆日期

2樓:盜夢語者

陽曆日期推算陰曆日期的方法:陰曆日期是以月亮的圓缺為計月單位,其以逢朔為初一,以月望為十五(大月為十六日),以月晦為二十九日(大月為三十 日)。然而目前記時通常用陽曆日期表達,如欲將陽曆日期換算成陰曆日期可以用以下兩種方法:

其一是查《新編萬年曆》,如查2023年6月8日是陰曆幾日? 翻開萬年曆6月10日是陰曆十一,則逆推6月8日是陰曆初九。其二可以利用公式推算陰曆日期:

設:公元年數-1977(或1901)=4q+r則:陰曆日期=14q+10.6(r+1)+年內日期序數-29.5n(注:式中q、r、n均為自然數,r<4)

例:2023年5月7日的陰曆日期為:

1994-1977=17=4×4+1

故:q=4,r=1 則:5月7日的陰曆日期為:

14×4+10.6(1+1)+(31+28+31+31+7)-29.5n

=204.2- 29.5n

然後用29.5去除204.2得商數6......27.2,6即是n值,餘數27即是陰曆二十七日。

怎樣由農曆日期推算出公曆日期

3樓:匿名使用者

由農曆日期推算出公曆日期有很多方法:

方法一:通過查萬年曆(工具書或手機

內自帶日曆功容

能)可得知,如果使用手機上的萬年曆的話,查詢年份範圍有限制。

4樓:天若有情佑曉峰

只有看日曆,沒辦法推算

5樓:進去上樓

看日曆嘛,老簡單,,,呵呵

在excel中如何生成公曆日期對應的農曆日期

6樓:匿名使用者

舉個例子,比如你的公曆日期在a1,你想在b1中顯示農曆日期,那你在b1可以輸入下面的函式:

=text(a1,"[$-130000]yyyy-m-d")

excel如何農曆轉換陽曆公式

7樓:匿名使用者

老美開發的excel中沒有這樣的函式公式。建議直接找份萬年曆查一查,然後手動輸入吧。

8樓:匿名使用者

網頁連結  不難,呼叫函式就出來了,非常準。

我也是網上找的,測試可用。驚喜。由衷感謝編寫外掛的大神。

在excel中怎樣把公曆轉換成農曆

9樓:匿名使用者

dim weekname(7), monthadd(11), nonglidata(99), tiangan(9), dizhi(11), shuxiang(11), dayname(30), monname(12)

dim curtime, curyear, curmonth, curday, curweekday

dim gonglistr, weekdaystr, nonglistr, nonglidaystr

dim i, m, n, k, isend, bit, thedate

private sub form_load()

'獲取當前系統時間

curtime = now()

'星期名

weekname(0) = " * "

weekname(1) = "星期日"

weekname(2) = "星期一"

weekname(3) = "星期二"

weekname(4) = "星期三"

weekname(5) = "星期四"

weekname(6) = "星期五"

weekname(7) = "星期六"

'天干名稱

tiangan(0) = "甲"

tiangan(1) = "乙"

tiangan(2) = "丙"

tiangan(3) = "丁"

tiangan(4) = "戊"

tiangan(5) = "己"

tiangan(6) = "庚"

tiangan(7) = "辛"

tiangan(8) = "壬"

tiangan(9) = "癸"

'地支名稱

dizhi(0) = "子"

dizhi(1) = "醜"

dizhi(2) = "寅"

dizhi(3) = "卯"

dizhi(4) = "辰"

dizhi(5) = "巳"

dizhi(6) = "午"

dizhi(7) = "未"

dizhi(8) = "申"

dizhi(9) = "酉"

dizhi(10) = "戌"

dizhi(11) = "亥"

'屬相名稱

shuxiang(0) = "鼠"

shuxiang(1) = "牛"

shuxiang(2) = "虎"

shuxiang(3) = "兔"

shuxiang(4) = "龍"

shuxiang(5) = "蛇"

shuxiang(6) = "馬"

shuxiang(7) = "羊"

shuxiang(8) = "猴"

shuxiang(9) = "雞"

shuxiang(10) = "狗"

shuxiang(11) = "豬"

'農曆日期名

dayname(0) = "*"

dayname(1) = "初一"

dayname(2) = "初二"

dayname(3) = "初三"

dayname(4) = "初四"

dayname(5) = "初五"

dayname(6) = "初六"

dayname(7) = "初七"

dayname(8) = "初八"

dayname(9) = "初九"

dayname(10) = "初十"

dayname(11) = "十?quot;"

dayname(12) = "十二"

dayname(13) = "十三"

dayname(14) = "十四"

dayname(15) = "十五"

dayname(16) = "十六"

dayname(17) = "十七"

dayname(18) = "十八"

dayname(19) = "十九"

dayname(20) = "二十"

dayname(21) = "廿一"

dayname(22) = "廿二"

dayname(23) = "廿三"

dayname(24) = "廿四"

dayname(25) = "廿五"

dayname(26) = "廿六"

dayname(27) = "廿七"

dayname(28) = "廿八"

dayname(29) = "廿九"

dayname(30) = "三十"

'農曆月份名

monname(0) = "*"

monname(1) = "正"

monname(2) = "二"

monname(3) = "三"

monname(4) = "四"

monname(5) = "五"

monname(6) = "六"

monname(7) = "七"

monname(8) = "八"

monname(9) = "九"

monname(10) = "十"

monname(11) = "十一"

monname(12) = "臘"

'公曆每月前面的天數

monthadd(0) = 0

monthadd(1) = 31

monthadd(2) = 59

monthadd(3) = 90

monthadd(4) = 120

monthadd(5) = 151

monthadd(6) = 181

monthadd(7) = 212

monthadd(8) = 243

monthadd(9) = 273

monthadd(10) = 304

monthadd(11) = 334

'農曆資料

nonglidata(0) = 2635

nonglidata(1) = 333387

nonglidata(2) = 1701

nonglidata(3) = 1748

nonglidata(4) = 267701

nonglidata(5) = 694

nonglidata(6) = 2391

nonglidata(7) = 133423

nonglidata(8) = 1175

nonglidata(9) = 396438

nonglidata(10) = 3402

nonglidata(11) = 3749

nonglidata(12) = 331177

nonglidata(13) = 1453

nonglidata(14) = 694

nonglidata(15) = 201326

nonglidata(16) = 2350

nonglidata(17) = 465197

nonglidata(18) = 3221

nonglidata(19) = 3402

nonglidata(20) = 400202

nonglidata(21) = 2901

nonglidata(22) = 1386

nonglidata(23) = 267611

nonglidata(24) = 605

nonglidata(25) = 2349

nonglidata(26) = 137515

nonglidata(27) = 2709

nonglidata(28) = 464533

nonglidata(29) = 1738

nonglidata(30) = 2901

nonglidata(31) = 330421

nonglidata(32) = 1242

nonglidata(33) = 2651

nonglidata(34) = 199255

nonglidata(35) = 1323

nonglidata(36) = 529706

nonglidata(37) = 3733

nonglidata(38) = 1706

nonglidata(39) = 398762

nonglidata(40) = 2741

nonglidata(41) = 1206

nonglidata(42) = 267438

nonglidata(43) = 2647

nonglidata(44) = 1318

nonglidata(45) = 204070

nonglidata(46) = 3477

nonglidata(47) = 461653

nonglidata(48) = 1386

nonglidata(49) = 2413

nonglidata(50) = 330077

nonglidata(51) = 1197

nonglidata(52) = 2637

nonglidata(53) = 268877

nonglidata(54) = 3365

nonglidata(55) = 531109

nonglidata(56) = 2900

nonglidata(57) = 2922

nonglidata(58) = 398042

nonglidata(59) = 2395

nonglidata(60) = 1179

nonglidata(61) = 267415

nonglidata(62) = 2635

nonglidata(63) = 661067

nonglidata(64) = 1701

nonglidata(65) = 1748

nonglidata(66) = 398772

nonglidata(67) = 2742

nonglidata(68) = 2391

nonglidata(69) = 330031

nonglidata(70) = 1175

nonglidata(71) = 1611

nonglidata(72) = 200010

nonglidata(73) = 3749

nonglidata(74) = 527717

nonglidata(75) = 1452

nonglidata(76) = 2742

nonglidata(77) = 332397

nonglidata(78) = 2350

nonglidata(79) = 3222

nonglidata(80) = 268949

nonglidata(81) = 3402

nonglidata(82) = 3493

nonglidata(83) = 133973

nonglidata(84) = 1386

nonglidata(85) = 464219

nonglidata(86) = 605

nonglidata(87) = 2349

nonglidata(88) = 334123

nonglidata(89) = 2709

nonglidata(90) = 2890

nonglidata(91) = 267946

nonglidata(92) = 2773

nonglidata(93) = 592565

nonglidata(94) = 1210

nonglidata(95) = 2651

nonglidata(96) = 395863

nonglidata(97) = 1323

nonglidata(98) = 2707

nonglidata(99) = 265877

'生成當前公曆年、月、日 ==> gonglistr

curyear = year(curtime)

curmonth = month(curtime)

curday = day(curtime)

gonglistr = curyear & "年"

if (curmonth < 10) then

gonglistr = gonglistr & "0" & curmonth & "月"

else

gonglistr = gonglistr & curmonth & "月"

end if

if (curday < 10) then

gonglistr = gonglistr & "0" & curday & "日"

else

gonglistr = gonglistr & curday & "日"

end if

'生成當前公曆星期 ==> weekdaystr

curweekday = weekday(curtime)

weekdaystr = weekname(curweekday)

'計算到初始時間2023年2月8日的天數:1921-2-8(正月初一)

thedate = (curyear - 1921) * 365 + int((curyear - 1921) / 4) + curday + monthadd(curmonth - 1) - 38

if ((curyear mod 4) = 0 and curmonth > 2) then

thedate = thedate + 1

end if

'計算農曆天干、地支、月、日

isend = 0

m = 0

do if (nonglidata(m) < 4095) then

k = 11

else

k = 12

end if

n = k

do if (n < 0) then

exit do

end if

'獲取nonglidata(m)的第n個二進位制位的值

bit = nonglidata(m)

for i = 1 to n step 1

bit = int(bit / 2)

next

bit = bit mod 2

if (thedate <= 29 + bit) then

isend = 1

exit do

end if

thedate = thedate - 29 - bit

n = n - 1

loop

if (isend = 1) then

exit do

end if

m = m + 1

loop

curyear = 1921 + m

curmonth = k - n + 1

curday = thedate

if (k = 12) then

if (curmonth = (int(nonglidata(m) / 65536) + 1)) then

curmonth = 1 - curmonth

elseif (curmonth > (int(nonglidata(m) / 65536) + 1)) then

curmonth = curmonth - 1

end if

end if

'生成農曆天干、地支、屬相 ==> nonglistr

nonglistr = "農曆" & tiangan(((curyear - 4) mod 60) mod 10) & dizhi(((curyear - 4) mod 60) mod 12) & "年"

nonglistr = nonglistr & "(" & shuxiang(((curyear - 4) mod 60) mod 12) & ")"

'生成農曆月、日 ==> nonglidaystr

if (curmonth < 1) then

nonglidaystr = "閏" & monname(-1 * curmonth)

else

nonglidaystr = monname(curmonth)

end if

nonglidaystr = nonglidaystr & "月"

nonglidaystr = nonglidaystr & dayname(curday)

msgbox nonglistr & nonglidaystr

end sub

參考資料:http://www.

wangchao.net.cn/bbsshowlist.

怎樣在excel中自動生成序號,在excel中怎樣自動生成一列序號1,2,3,4,5,

請補充完整提問,或截圖示例,以方便大家理解支招!按什麼規則,在什麼位置自動生成序號?如果需要在a1 a100自動生成序號,那麼在左上角名稱框輸入a1 a100,然後輸入 row 按ctrl enter組合鍵結束。中很多用的序號,往往一個個錄入比較麻煩,可以利用row 函式來完成自動生成序號。for ...

C中怎麼通過計算獲得幾天前的日期

通過呼叫類中的各種方法我們可以獲取不同的時間 如 日期 2008 09 04 時間 12 12 12 日期 時間 2008 09 04 12 11 10 等。獲取日期 時間 datetime.now.tostring 2008 9 4 20 02 10 datetime.now.tolocaltim...

EXCEL中根據員工入職時間計算年假天數

1 選擇c2單元格,輸入 datedif b2,today y 按回車確認,自動計算出小百的工齡。today 表示系統當前的日期 datedif b2,today y 表示計算b2單元格中的日期與系統當前的日期之間的年差。2 複製c2單元格,填充至c3 c5區域,自動計算出其他員工的工齡。3 選擇d...