View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.misc
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default find date of last weekday of a month

On Fri, 27 Oct 2006 23:22:03 -0700, TUNGANA KURMA RAJU
wrote:

Thank you Biff, I want another tough task to achieve.
Month end(last) thursday of a month is expirydate of a product.If I buy the
product before or last thursday of the month the expiry date is date of the
last thursday.The new expiry cycle starts from last friday.How to write a
formula to achieve this.
Example:
cellA1(Buy date) -------------------------------Cell B1(Expiry date)
01-OCT-2006------THE RESULT WILL BE ----- 26-OCT-2006
25-OCT-2006 ------ ------DO------------------26-OCT-2006
26-OCT-2006------ ----------DO------------------26-OCT-2006
27-OCT-2006----- ----------DO------------------30-NOV-2006
29-NOV-2006-----------------DO------------------30-NOV-2006
01-SEP-2006------------------DO-----------------28-SEP-2006
01-DEC-2006-----------------DO------------------28-DEC-2006



=DATE(YEAR(BuyDate),MONTH(BuyDate)+1+(BuyDateDATE (YEAR(BuyDate),
MONTH(BuyDate)+1,1)-WEEKDAY(DATE(YEAR(BuyDate),MONTH(BuyDate)+1,1)
+2)),1)-WEEKDAY(DATE(YEAR(BuyDate),MONTH(BuyDate)+1+(BuyDa teDATE(
YEAR(BuyDate),MONTH(BuyDate)+1,1)-WEEKDAY(DATE(YEAR(BuyDate),
MONTH(BuyDate)+1,1)+2)),1)+2)
--ron