Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Number of sundays

Hi,
I have a date which is a sunday and I need to find how
many sundays it is from the begining of the year.

Thanks MarkS
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default Number of sundays

Mark,

Try this.

Function SundaysFromStartOfYear(dtInput As Date)
'assumes dtinput is a sunday
SundaysFromStartOfYear = Int((dtInput - DateSerial(Year(dtInput), 1, 1)) /
7) + 1
End Function

Robin Hammond
www.enhanceddatasystems.com

"Mark Scholes" wrote in message
...
Hi,
I have a date which is a sunday and I need to find how
many sundays it is from the begining of the year.

Thanks MarkS



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Number of sundays

On Tue, 22 Feb 2005 16:36:43 -0800, "Mark Scholes"
wrote:

Hi,
I have a date which is a sunday and I need to find how
many sundays it is from the begining of the year.

Thanks MarkS


With your Sunday date in A1:

=(A1-DATE(YEAR(A1),1,7)+WEEKDAY(DATE(YEAR(A1),1,6)))/7+1

gives the Sunday number; counting the first Sunday in the year as number 1.

If you don't want to count the first Sunday, then omit the +1 at the end of the
formula.


--ron
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Number of sundays

On Tue, 22 Feb 2005 16:36:43 -0800, "Mark Scholes"
wrote:

Hi,
I have a date which is a sunday and I need to find how
many sundays it is from the begining of the year.

Thanks MarkS


OOPS.

My formula should be:

=DATE(YEAR(A1),1,8)-WEEKDAY(DATE(YEAR(A1),1,7))


--ron
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Number of sundays

On Tue, 22 Feb 2005 16:36:43 -0800, "Mark Scholes"
wrote:

Hi,
I have a date which is a sunday and I need to find how
many sundays it is from the begining of the year.

Thanks MarkS


Maybe now that I am awake I can get it correct:

=(A1-DATE(YEAR(A1),1,8)+WEEKDAY(DATE(YEAR(A1),1,7)))/7+1

--ron
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
Sundays Maresa Excel Worksheet Functions 5 August 26th 09 06:52 PM
Get all Sundays Rick[_5_] Excel Worksheet Functions 4 September 6th 07 12:01 PM
Number of sundays between two dates Carianne72 Excel Worksheet Functions 4 August 9th 06 02:58 AM
Calculate the number of Saturdays or Sundays between 2 dates? Jim Long Excel Discussion (Misc queries) 1 November 1st 05 07:13 PM
Need number of Saturdays and number of Sundays between 2 dates Class316 Excel Worksheet Functions 1 June 10th 05 02:47 AM


All times are GMT +1. The time now is 11:50 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"