What does the code mean?

  • Thread starter Thread starter Á÷À˵ÄË«Óã
  • Start date Start date
Á

Á÷À˵ÄË«Óã

DATE(y,m,1)-(WEEKDAY(DATE(y,m,1))-1)+{0;1;2;3;4;5}*7+{1,2,3,4,5,6,7}-1
I acquired the code from NG.
But I can't understand it.
Can anyone explain it for me?
Thanks in advance.
--
 
Not sure how it works but it looks to calculate the last Sunday prior to the
month entered.

For example:

=DATE(2005,9,1)-(WEEKDAY(DATE(2005,9,1))-1)+{0;1;2;3;4;5}*7+{1,2,3,4,5,6,7}-1
gives 28/08/2005 which is a Sunday

Regards

Trevor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top