Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default calculate weekdays only

You can do this with formula or code. Which one is
necessary for your application?
-----Original Message-----
I am looking for code to insert yesterday's date if

yesterday was a weekday,
and to use the previous Friday's date otherwise (if

yesterday was Sunday).
Anyone know how to do this? Thanks.
.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default calculate weekdays only

I prefer to do it with code. Is there also an Excel function that does this
I am unaware of?

"Mike" wrote:

You can do this with formula or code. Which one is
necessary for your application?
-----Original Message-----
I am looking for code to insert yesterday's date if

yesterday was a weekday,
and to use the previous Friday's date otherwise (if

yesterday was Sunday).
Anyone know how to do this? Thanks.
.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default calculate weekdays only

dtDate = Range(A1)-1-choose(Weekday(Range(A1).Value)-1,2,0,0,0,0,0,1)

--
Regards,
Tom Ogilvy


"benb" wrote in message
...
I prefer to do it with code. Is there also an Excel function that does

this
I am unaware of?

"Mike" wrote:

You can do this with formula or code. Which one is
necessary for your application?
-----Original Message-----
I am looking for code to insert yesterday's date if

yesterday was a weekday,
and to use the previous Friday's date otherwise (if

yesterday was Sunday).
Anyone know how to do this? 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
Weekdays Kerryn Excel Discussion (Misc queries) 7 July 5th 08 01:56 AM
Weekdays only! rexmann Excel Discussion (Misc queries) 2 August 14th 07 02:52 PM
Weekdays Jeff Excel Discussion (Misc queries) 7 February 15th 05 12:18 AM
calculate weekdays only Tom Ogilvy Excel Programming 0 September 21st 04 10:19 PM
Calculate weekdays from two dates JZ[_2_] Excel Programming 1 October 16th 03 09:26 PM


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