ChristinaBB
New Member
- Joined
- Nov 23, 2010
- Messages
- 6
I am trying to convert the following Python Algoritm (source: Algorithm on how to find the day of a week):
day_of_week(year, month, day):
t = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4]
year -= month < 3
return (year + int(year/4) - int(year/100) + int(year/400) + t[month-1] + day) % 7
to an excel formula, but the result comes out wrong:
I'm calculating the day (0=Sunday) as: =MOD(year+INT(year/4)-INT(year/100)+INT(year/400)+OFFSET(t,IF(Adj_month=0,12,Adj_month-1),0)+Day,7)
Adj_month=Month+IF(Month<3,-1)-1
And t is the top value in this list:
day_of_week(year, month, day):
t = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4]
year -= month < 3
return (year + int(year/4) - int(year/100) + int(year/400) + t[month-1] + day) % 7
to an excel formula, but the result comes out wrong:
I'm calculating the day (0=Sunday) as: =MOD(year+INT(year/4)-INT(year/100)+INT(year/400)+OFFSET(t,IF(Adj_month=0,12,Adj_month-1),0)+Day,7)
Adj_month=Month+IF(Month<3,-1)-1
And t is the top value in this list: