Fortune Telling Collection - Free divination - Write judging constellations by date of birth in EXCEL with VB language!
Write judging constellations by date of birth in EXCEL with VB language!
But this method has a hidden bug: leap year. The constellation division day of leap year will increase by 1 after March. Hidden bugs are taboo! If someone calls your function, there will always be irregular errors. Sometimes you can't find the problem because your function has this hidden bug.
In order to bypass the bug of leap year, I wrote the following function, directly imitating the process of human flesh querying the month and day.
Of course, there are also some places that can be optimized. For example, the array of months can be directly optimized because the dimensions and contents are the same; For example, the final if statement structure can be replaced by iif statement. But these are the details. In order to better reflect the programming ideas, we will not do these "clever" optimizations.
Constellation function in string form (X stands for date)
Dim XZ( 12) as a string.
Dim Yue( 12) as the length
Dim Ri( 12) As Long
XZ(0) = "Capricorn"
XZ( 1) = "Aquarius"
XZ(2) = "Pisces"
XZ(3) = "Aries"
XZ(4) = "Taurus"
XZ(5) = "Gemini"
XZ(6) = "cancer"
XZ(7) = "Leo"
XZ(8) = "Virgo"
XZ(9) = "Libra"
XZ( 10) = "Scorpio"
XZ( 1 1) = "Sagittarius"
XZ( 12) = "Capricorn"
Yue (1) = 1
Yue (2) = 2
Yue (3) = 3
Yue (4) = 4
Yue (5) = 5
Yue (6) = 6
Yue (7) = 7
Yue (8) = 8
Yue (9) = 9
Yue (10) = 10
Yue (11) =11
Yue (12) = 12
Ri( 1) = 20
Ri(2) = 19
Ri(3) = 2 1
Ri(4) = 20
Ri(5) = 2 1
Ri(6) = 22
Ri(7) = 23
Ri(8) = 23
Ri(9) = 23
Ri( 10) = 24
Ri( 1 1) = 23
Ri( 12) = 22
M = month (x)
D = days (x)
If d< day (day (meter)) and then
Horoscope = XZ (Yue (m)-1)
other
Horoscope = XZ (month (meter))
If ... it will be over.
End function
- Previous article:Dragon ball viewing order
- Next article:What does it mean that people are divined?
- Related articles
- Recommend some good mystery novels, with pictures on the cover.
- Test which constellations like to dig people's privacy best.
- What is Aquarius?
- How old is Liu Chan?
- Who killed the full-time hunter who hurt you the most?
- The funniest issues of running men
- The implication and symbol of jadeite
- How to play the little devil Liu Kelie in the battle of the golden shovel?
- Dreaming of helping others return messages.
- What's the name of the animation game! ! !