Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Minitman
 
Posts: n/a
Default Date Command to Get the Sunday Before the First of the Month

Greetings,

I have a weekly schedule that starts on the Sunday of the week of the
first day of the month (unless it starts on a Saturday). Since this
day will change almost every month, is there a special date command to
accomplish this in a cell formula?

Any help would be appreciated.

TIA

-Minitman.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Peo Sjoblom
 
Posts: n/a
Default Date Command to Get the Sunday Before the First of the Month

What do you mean? Last Sunday of the month which is the Sunday before the
first of the month (your subject line)?
Or first Sunday of the month unless the first is a Saturday?

--
Regards,

Peo Sjoblom

(No private emails please)


"Minitman" wrote in message
...
Greetings,

I have a weekly schedule that starts on the Sunday of the week of the
first day of the month (unless it starts on a Saturday). Since this
day will change almost every month, is there a special date command to
accomplish this in a cell formula?

Any help would be appreciated.

TIA

-Minitman.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove
 
Posts: n/a
Default Date Command to Get the Sunday Before the First of the Month

"Minitman" wrote...
I have a weekly schedule that starts on the Sunday of the week of the
first day of the month (unless it starts on a Saturday). Since this
day will change almost every month, is there a special date command to
accomplish this in a cell formula?


Given a date D, the last day of the previous month is always given by

D-DAY(D)

The last Sunday of the previous month is always given by

D-DAY(D)-WEEKDAY(D-DAY(D),1)+1

IF the following Saturday is the first day of the next month, then the last
day of the previous month is Friday, so

WEEKDAY(D-DAY(D),1)=6

So when the first day of the month is a Saturday, I'd infer you'd want to
treat that as the last day of the final week of the preceding month. If so,
the first Sunday of the month is given by

=D-DAY(D)-WEEKDAY(D-DAY(D),1)+IF(WEEKDAY(D-DAY(D),1)=6,8,1)


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Minitman
 
Posts: n/a
Default Date Command to Get the Sunday Before the First of the Month

Hey Harlan,

That is exactly what I was looking for - Thank You!

-Minitman



On Thu, 1 Dec 2005 20:21:19 -0800, "Harlan Grove"
wrote:

"Minitman" wrote...
I have a weekly schedule that starts on the Sunday of the week of the
first day of the month (unless it starts on a Saturday). Since this
day will change almost every month, is there a special date command to
accomplish this in a cell formula?


Given a date D, the last day of the previous month is always given by

D-DAY(D)

The last Sunday of the previous month is always given by

D-DAY(D)-WEEKDAY(D-DAY(D),1)+1

IF the following Saturday is the first day of the next month, then the last
day of the previous month is Friday, so

WEEKDAY(D-DAY(D),1)=6

So when the first day of the month is a Saturday, I'd infer you'd want to
treat that as the last day of the final week of the preceding month. If so,
the first Sunday of the month is given by

=D-DAY(D)-WEEKDAY(D-DAY(D),1)+IF(WEEKDAY(D-DAY(D),1)=6,8,1)


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Minitman
 
Posts: n/a
Default Date Command to Get the Sunday Before the First of the Month

Hey Harlan,

There are two other dates that I need. The first day of the year for
the month in question and a way to tell if the year in question is a
leap year or not (This schedule I am making spans 13 years or more).

Your continued assistance is very appreciated. Thanks.

-Minitman


On Thu, 1 Dec 2005 20:21:19 -0800, "Harlan Grove"
wrote:

"Minitman" wrote...
I have a weekly schedule that starts on the Sunday of the week of the
first day of the month (unless it starts on a Saturday). Since this
day will change almost every month, is there a special date command to
accomplish this in a cell formula?


Given a date D, the last day of the previous month is always given by

D-DAY(D)

The last Sunday of the previous month is always given by

D-DAY(D)-WEEKDAY(D-DAY(D),1)+1

IF the following Saturday is the first day of the next month, then the last
day of the previous month is Friday, so

WEEKDAY(D-DAY(D),1)=6

So when the first day of the month is a Saturday, I'd infer you'd want to
treat that as the last day of the final week of the preceding month. If so,
the first Sunday of the month is given by

=D-DAY(D)-WEEKDAY(D-DAY(D),1)+IF(WEEKDAY(D-DAY(D),1)=6,8,1)




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove
 
Posts: n/a
Default Date Command to Get the Sunday Before the First of the Month

Minitman wrote...
There are two other dates that I need. The first day of the year for
the month in question . . .


=DATE(YEAR(D),1,1)

. . . and a way to tell if the year in question is a
leap year or not (This schedule I am making spans 13 years or more).

....

=MONTH(DATE(YEAR(D),2,29))=2

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Minitman
 
Posts: n/a
Default Date Command to Get the Sunday Before the First of the Month

Thanks Harlan, this will take care of that problem nicely.

-Minitman


On 2 Dec 2005 09:21:59 -0800, "Harlan Grove" wrote:

Minitman wrote...
There are two other dates that I need. The first day of the year for
the month in question . . .


=DATE(YEAR(D),1,1)

. . . and a way to tell if the year in question is a
leap year or not (This schedule I am making spans 13 years or more).

...

=MONTH(DATE(YEAR(D),2,29))=2


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
add month to date oomyoo Excel Worksheet Functions 3 December 2nd 05 09:51 PM
Get month from date [email protected] Excel Discussion (Misc queries) 2 November 9th 05 02:43 PM
4 and 5 week months Big Rick Excel Discussion (Misc queries) 15 November 7th 05 12:32 AM
GETTING MONTH FROM A DATE [email protected] Excel Discussion (Misc queries) 8 October 6th 05 01:26 AM
Lookup the month in a date string 01/03/05 Una Excel Worksheet Functions 1 March 30th 05 09:45 AM


All times are GMT +1. The time now is 02:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"