Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Determine Last working day of Month

Is there any way to determine the last working day of a month by using code

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Determine Last working day of Month

=DATE(YEAR(A6),MONTH(A6)+1,0)-(WEEKDAY(DATE(YEAR(A6),MONTH(A6)+1,0),2)5)-(W
EEKDAY(DATE(YEAR(A6),MONTH(A6)+1,0),2)=7)

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"Nigel" wrote in message
...
Is there any way to determine the last working day of a month by using

code

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Determine Last working day of Month

Hi Nigel,

supposing that Input_Date is a date:

(Int(CDbl(Input_Date)) - 1) Mod 7 = 6 'saturday
(Int(CDbl(Input_Date)) - 1) Mod 7 = 0 'sunday

Did it help?

Regards,
Ivan

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Determine Last working day of Month

Dim dt as Date
Dim dtLastDay as Date
dt = date
dtLastDay = DateSerial(year(dt),month(dt)+1,0)
if Weekday(dtLastDay,vbMonday) 5 then
dtlast = dtLastDay - (Weekday(dtLastDay,vbMonday) - 5)
' consider holidays?
end if

--
Regards,
Tom Ogilvy

"Nigel" wrote:

Is there any way to determine the last working day of a month by using code

Thanks

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Determine Last working day of Month

Probably pre-empting the original question, but the request was for
last working day of a month - the code that has been given gives the
last weekday of the month (ie Monday through Friday) - what about if
that day is a public or other holiday - that would need to be
incorporated which would make the project a little more complicated! I
have done it in Access, with a table for holidays, and there are
functions in excel we could use, but not sure about "IN CODE"



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Determine Last working day of Month

I'm not sure precisely how to work this in - but you can use the
=workday(a,b,c) function in the analysis tookpak to help with this (there is
also a vba version)

a = start date
b = number of working days to count
c = range with a list of holidays (or the list itself I guess).
this will avoid weekends as well as the list of holidays.
haven't thought it out on how to use this - this function is also available
to a VBA routine - however I'm not sure how to get one add-in to call a
routien in another add-in - I have a question pending on that myself - hope
this helps


"Nigel" wrote:

Is there any way to determine the last working day of a month by using code

Thanks

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
Determine if a month falls between two dates. Robert R Excel Worksheet Functions 6 April 24th 23 09:00 PM
Need a way to determine the # of Saturdays in a month Chuck M Excel Worksheet Functions 4 July 5th 07 09:34 PM
How to determine the number of month between 2 periods? Eric Excel Discussion (Misc queries) 5 March 8th 07 12:04 AM
How to determine the number of month between 2 periods? Eric Excel Worksheet Functions 1 March 7th 07 04:00 PM
A formula or macro that determine the correct month leitek.com Excel Programming 2 March 7th 06 08:36 PM


All times are GMT +1. The time now is 10:42 AM.

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"