View Single Post
  #15   Report Post  
Roger Govier
 
Posts: n/a
Default

Hi Sige

Glad you got it to work.
With regard to making the first column be a Monday just change the -1 to a
-2 in both parts of the formula
(WEEKDAY(DATE(YEAR(A1),MONTH(A1),1))-2)

You also menioned in your private email to me, making the formula work for
other months.
One way would be to change the NOW() to a cell reference like A1 and mark a
block of cells from B2:G6 to paste the following formula (English version,
change separators as before)

{=IF(MONTH(DATE(YEAR(A1),MONTH(A1),1))-
MONTH(DATE(YEAR(A1),MONTH(A1),1)-
(WEEKDAY(DATE(YEAR(A1),MONTH(A1),1))-2)+
{0;1;2;3;4;5}*7+{1,2,3,4,5,6,7}-1),"",DATE(YEAR(A1),
MONTH(A1),1)-(WEEKDAY(DATE(YEAR(A1),
MONTH(A1),1))-2)+{0;1;2;3;4;5}*7+{1,2,3,4,5,6,7}-1)}

If you format cell A1 as mmmm then it will nicely display the month name at
the top of your calendar.

The other way of getting different months would be to still use the NOW()
function, but for each occurrence of MONTH(NOW()), make it MONTH(NOW())+1 or
+2 or -1, -2 etc.

Regards

Roger Govier


wrote:
Hi There,

Roger was so kind to mail me his solution(s) ... the original formula
looks as follows on my system.

=IF(MONTH(DATE(YEAR(NOW());MONTH(NOW());1))-
MONTH(DATE(YEAR(NOW());MONTH(NOW());1)-
(WEEKDAY(DATE(YEAR(NOW());MONTH(NOW());1))-1)+
{0;1;2;3;4;5}*7+{1\2\3\4\5\6\7}-1);"";DATE(YEAR(NOW());
MONTH(NOW());1)-(WEEKDAY(DATE(YEAR(NOW());
MONTH(NOW());1))-1)+{0;1;2;3;4;5}*7+{1\2\3\4\5\6\7}-1)

Works like a charm!
I will just try to get monday as first day of the week.