Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 132
Default Can I get no of Sundays and working days of the month?

I have a date in a1 as 13/04/2009. Can I get a formula to return total no of
Sundays in this month of the date? Also Can I get total no of days except
Sundays?
Thanks,
Narnimar
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 248
Default Can I get no of Sundays and working days of the month?

=DATE(YEAR(A1),MONTH(A1)+1,0)-DATE(YEAR(A1),MONTH(A1),1)
will give you the number of days in the month
and
=INT((DAY(DATE(YEAR(A1),MONTH(A1)+1,0))-DAY(DATE(YEAR(A1),MONTH(A1),1)+IF(WEEKDAY(A1)=1,1, 7-WEEKDAY(A1))))/7)+1
will give you the number of sundays

Hopefully someone else will come up with a more elegant solution
--
Pl click the YES button
(if you see it - don''''''''t worry if you don''t),
if this answer was helpful.



"Narnimar" wrote:

I have a date in a1 as 13/04/2009. Can I get a formula to return total no of
Sundays in this month of the date? Also Can I get total no of days except
Sundays?
Thanks,
Narnimar

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 132
Default Can I get no of Sundays and working days of the month?

Thanks but I requested total days except Sundays, 1st formula returned 29
days which must be 30days - 4 Sundays for 13/apr/2009 right?
Your 2nd formula is correct. If I need Fridays instead of Sundays How to
make it?

Best regards,
Narnimar.

"Sheeloo" wrote:

=DATE(YEAR(A1),MONTH(A1)+1,0)-DATE(YEAR(A1),MONTH(A1),1)
will give you the number of days in the month
and
=INT((DAY(DATE(YEAR(A1),MONTH(A1)+1,0))-DAY(DATE(YEAR(A1),MONTH(A1),1)+IF(WEEKDAY(A1)=1,1, 7-WEEKDAY(A1))))/7)+1
will give you the number of sundays

Hopefully someone else will come up with a more elegant solution
--
Pl click the YES button
(if you see it - don''''''''t worry if you don''t),
if this answer was helpful.



"Narnimar" wrote:

I have a date in a1 as 13/04/2009. Can I get a formula to return total no of
Sundays in this month of the date? Also Can I get total no of days except
Sundays?
Thanks,
Narnimar

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 248
Default Can I get no of Sundays and working days of the month?

Yes, I forgot to add 1 to the formula
Use
=DATE(YEAR(A1),MONTH(A1)+1,0)-DATE(YEAR(A1),MONTH(A1),1) + 1

For Fridays try
=INT((DAY(DATE(YEAR(A2),MONTH(A2)+1,0))-DAY(DATE(YEAR(A2),MONTH(A2),1)+IF(WEEKDAY(DATE(YEA R(A2),MONTH(A2),1))<7,6-WEEKDAY(DATE(YEAR(A2),MONTH(A2),1)),6)))/7)+1

Do test it out ...
--
Pl click the YES button
(if you see it - don''''''''t worry if you don''t),
if this answer was helpful.



"Narnimar" wrote:

Thanks but I requested total days except Sundays, 1st formula returned 29
days which must be 30days - 4 Sundays for 13/apr/2009 right?
Your 2nd formula is correct. If I need Fridays instead of Sundays How to
make it?

Best regards,
Narnimar.

"Sheeloo" wrote:

=DATE(YEAR(A1),MONTH(A1)+1,0)-DATE(YEAR(A1),MONTH(A1),1)
will give you the number of days in the month
and
=INT((DAY(DATE(YEAR(A1),MONTH(A1)+1,0))-DAY(DATE(YEAR(A1),MONTH(A1),1)+IF(WEEKDAY(A1)=1,1, 7-WEEKDAY(A1))))/7)+1
will give you the number of sundays

Hopefully someone else will come up with a more elegant solution
--
Pl click the YES button
(if you see it - don''''''''t worry if you don''t),
if this answer was helpful.



"Narnimar" wrote:

I have a date in a1 as 13/04/2009. Can I get a formula to return total no of
Sundays in this month of the date? Also Can I get total no of days except
Sundays?
Thanks,
Narnimar

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Can I get no of Sundays and working days of the month?

On Mon, 13 Apr 2009 11:33:13 -0700, Narnimar
wrote:

I have a date in a1 as 13/04/2009. Can I get a formula to return total no of
Sundays in this month of the date? Also Can I get total no of days except
Sundays?
Thanks,
Narnimar


Total number of Sundays:

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1-DAY(A1)+1
&":"& A1-DAY(A1)+32-DAY(A1-DAY(A1)+32))))=1))

Number of days except Sundays:

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1-DAY(A1)+1
&":"& A1-DAY(A1)+32-DAY(A1-DAY(A1)+32))))<1))

--ron


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Can I get no of Sundays and working days of the month?

On Mon, 13 Apr 2009 11:33:13 -0700, Narnimar
wrote:

I have a date in a1 as 13/04/2009. Can I get a formula to return total no of
Sundays in this month of the date? Also Can I get total no of days except
Sundays?
Thanks,
Narnimar


And I saw in a subsequent message you wanted to be able to choose the Weekday
to count.

In the formula I posted:

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1-DAY(A1)+1
&":"& A1-DAY(A1)+32-DAY(A1-DAY(A1)+32))))=1))

the last 1 represents the day of the week, where 1=Sunday, 2=Monday, etc.

Friday would = 6.

or (note where I have DOW for Day Of Week)

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1-DAY(A1)+1
&":"& A1-DAY(A1)+32-DAY(A1-DAY(A1)+32))))=DOW))
--ron
  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,180
Default Can I get no of Sundays and working days of the month?

Excel 2007
Table
Structured References
http://www.mediafire.com/file/ui2jji2am23/04_13_09.xlsx
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
Working Days excluding Sundays danh Excel Discussion (Misc queries) 6 March 31st 07 08:52 PM
Working days left in a month. [email protected] Excel Worksheet Functions 4 January 28th 07 09:56 PM
Excel - list days of a month, excluding Sundays John Excel Discussion (Misc queries) 1 January 3rd 06 04:43 PM
amount of working days per month Nigel Excel Discussion (Misc queries) 2 November 29th 05 10:41 AM
Working days left in the month compared to previous months qwopzxnm Excel Worksheet Functions 8 October 24th 05 08:00 PM


All times are GMT +1. The time now is 01:29 PM.

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

About Us

"It's about Microsoft Excel"