當前位置:吉日网官网 - 黃道吉日 - 用Excel計算農歷日期

用Excel計算農歷日期

函數bj(StrA,StrB) bj = " '函數初始化。如果沒有相同的內容,或者其中有壹個空文本列,則輸出壹個空結果。if Len(StrA)& lt;Len(StrB)然後

StrShort = StrA

StrLong = StrB

LenShort = Len(StrA)

LenLong = Len(StrB)

其他

StrShort = StrB

StrLong = StrA

LenShort = Len(StrB)

LenLong = Len(StrA)

End If '首先比較字長並賦值。for I = LenShort to 1 Step-1 '從最大字符長度Len Short到最短字符StrShort循環“I”次。

對於j = 1到len short-I+1 '對於最短的單詞StrShort,依次從其首字母開始,按照單詞長度“I”循環。

StrC = Mid(StrShort,j,I)'從上述字符中取出選定的字符,從首字母開始,按字長“I”排列,作為比較字符。

對於k = 1到lenlong-i+1 '對於最長的單詞StrLong,它以第壹個字母開始,以相同的單詞長度“I”結束。

StrD = Mid(StrLong,k,I)'取出上述字符StrLong,從首字母中選擇字長“I”相同的字符進行比較;

如果StrD = StrC,則比較。如果比較的內容相同,則該函數具有正確的結果。

Bj = StrC '輸出結果。

“退出函數”結束函數。

如果…就會結束

下壹個k

下壹個j

下壹iEnd函數

大寫字符串形式的函數rmbs (RNG變體)。

申請。不穩定的

如果不是vba。isnumeric(RNG)then rmbs = " ":exit function '如果不是數字,則返回零。

如果RNG = " "那麽rmbs = "":exit function '如果為null,則返回null。

如果RNG = 0,則RMB = "":exit function '如果為0,則返回“零舍入”。

Rmbs = replace(替換(應用。text (round (RNG,2),"[dbnum2]"," "、“圈”)、“-”、“負”)'精確到兩位,小數點用圈代替,負號用“負”代替。

Rmbs = IIF (left (right (rmbs,3),1) = "circle ",left (rmbs,len(rmbs)-1)&;“角度”&;右(Rmbs,1)& amp;“分”,IIF (left (right (rmbs,2),1) =“圓”,rmbs &;“角度”,rmbs & amp;“圓形”))

Rmbs = Replace(Replace(Rmbs,"零圓","零角度","零角度)"替換零角度字符。

end Function public Function NongLi(可選XX_DATE作為日期)

Dim MonthAdd(11)、NongliData(99)、天幹(9)、地直(11)、書香(11)、DayName(30)、MonName(12)

陰歷、陰歷、陰歷、陰歷

Dim GongliStr,NongliStr,NongliDayStr

Dim i,m,n,k,isEnd,bit,TheDate '獲取當前系統時間。

CurTime = XX_DATE '天幹姓名

天幹(0) =“壹”

天幹(1)=“B”

天幹(2) =“丙”

天幹(3) =“定”

天幹(4)=“E”

天幹(5) =“己”

天幹(6) =“更”

天幹(7) =“心”

天幹(8) =“壬”

天幹(9) =“癸”

地支名稱

嫡支(0) =“子”

地直(1) =“醜”

地直(2) =“陰”

邸誌(3) =“毛”

狄誌(4) =“陳”

地直(5) =“是”

地直(6) =“正午”

第七題)=“不是”

嫡之(8) =“申”

嫡支(9) =“酉”

地直(10) =“許”

地直(11) =“海”

動物星座名稱

書香(0) =“鼠”

書香(1) =“牛”

書香(2) =“老虎”

書香(3) =“兔子”

書香(4) =“龍”

書香(5) =“蛇”

書香(6) =“馬”

書香(7) =“羊”

書香(8) =“猴”

書香(9) =“雞”

書香(10) =“狗”

書香(11) =“豬”

農歷日期名稱

DayName(0) = "* "

DayName(1) = "壹年級"

DayName(2) = "等級2 "

DayName(3) =“初三”

日名(4) = "四級"

DayName(5) = "第五天"

DayName(6) = "第六天"

DayName(7) = "第七天"

day name(8)= " 8級"

DayName(9) = "第九天"

DayName(10) = "第10天"

日名(11) = "十壹"

DayName(12) = "十二"

DayName(13) = "十三"

日名(14) = "14 "

日名(15) = "15 "

DayName(16) = "十六"

DayName(17) = "十七"

日名(18) = "18 "

DayName(19) = "十九"

DayName(20) = "Twenty "

日名(21) = "21 "

DayName(22) = "22 "

DayName(23) = "23 "

DayName(24) = "24 "

DayName(25) = "25 "

DayName(26) = "26 "

DayName(27) = "27 "

DayName(28) = "28 "

DayName(29) = "29 "

DayName(30) = "三十"

農歷月份名稱

MonName(0) = "* "

MonName(1) = "正"

MonName(2) = "two "

MonName(3) = "三"

MonName(4) = "四"

MonName(5) = "five "

MonName(6) = "six "

MonName(7) = "seven "

MonName(8) = "八"

MonName(9) = "九"

MonName(10) = "十"

MonName(11) = "十壹"

MonName(12) = "La "

公歷中每個月的前幾天

MonthAdd(0) = 0

month addd(1)= 31

MonthAdd(2) = 59

MonthAdd(3) = 90

MonthAdd(4) = 120

MonthAdd(5) = 151

month addd(6)= 181

month addd(7)= 212

MonthAdd(8) = 243

MonthAdd(9) = 273

month addd(10)= 304

month addd(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

生成當前公歷年、月、日= = & gt鞏俐斯特

curYear = Year(curTime)

curMonth =月(curTime)

curDay = Day(curTime)

鞏GongliStr = curYear & amp"年份"

if(curMonth & lt;10)

鞏liStr =鞏GongliStr & amp0 & amp;柯月& amp“月亮”

其他

鞏liStr =鞏GongliStr & amp柯月& amp“月亮”

如果…就會結束

if(curDay & lt;10)

鞏liStr =鞏GongliStr & amp0 & amp;curDay & amp“日”

其他

鞏liStr =鞏GongliStr & ampcurDay & amp“日”

如果…就會結束

起始時間1921 2月8日起天數:1921-2-8(正月初壹)。

the date =(cur year-1921)* 365+Int((cur year-1921)/4)+curDay+month add(cur month-1)-38

If ((curYear Mod 4) = 0且curMonth & gt2)然後

日期=日期+ 1

如果…就會結束

計算農歷的天幹地支月日。

isEnd = 0

m = 0

if(NongliData(m)& lt;4095)那麽

k = 11

其他

k = 12

如果…就會結束

n = k

如果(n & lt0)然後

出口Do

如果…就會結束

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

bit = NongliData(m)

對於i = 1到n步1

bit = Int(bit / 2)

然後

bit = bit Mod 2

if(the date & lt;= 29 +位)那麽

isEnd = 1

出口Do

如果…就會結束

TheDate = TheDate - 29位

n = n - 1

If (isEnd = 1)則

出口Do

如果…就會結束

m = m + 1

curYear = 1921 + m

curMonth = k - n + 1

curDay = TheDate

如果(k = 12)那麽

if(cur month =(Int(NongliData(m)/65536)+1))則

curMonth = 1 - curMonth

else if(cur month & gt;(Int(NongliData(m)/65536)+1))然後

curMonth = curMonth - 1

如果…就會結束

如果…就會結束

生成農歷的天幹地支生肖= = & gt非列表者

NongliStr = "農歷新年" &;天幹((4年)60日)10日);迪誌(((4年)模60)模12);"年份"

NongliStr = NongliStr & amp"(" & amp書香(((4年)Mod 60)Mod 12);")"

生成農歷月和日== >非liDayStr

if(curMonth & lt;1)然後

NongliDayStr = " leap " &;MonName(-1 * curMonth)

其他

NongliDayStr = MonName(curMonth)

如果…就會結束

NongliDayStr = NongliDayStr & amp“月亮”

NongliDayStr = NongliDayStr & ampday name(curDay)NongLi = NongliStr & amp;NongliDayStrEnd函數這是農歷同期代碼計算日期的函數,days360。

  • 上一篇:湖北婚俗:婚禮前壹天祭祖。
  • 下一篇:祖墳風水怎麽化解?
  • copyright 2024吉日网官网