#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default date calculation

I need a formula that will return the last day of the month for a period of
two months prior to the date I enter. For example, if I enter 1/1/08 in Cell
A1, I want Cell B1 to return 11/30/07; if I enter 2/1/08 in Cell A1, I want
Cell B1 to return 12/31/07, etc..

P.S. Cell A1 will always be the first day of the month (if that matters)

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 171
Default date calculation

Since the 0th day of one month is the last day of the prior month,
=DATE(YEAR(A1),MONTH(A1)-1,0) (the 0th day of last month).
Or, if A1 is always the 1st of the month, you could also use
=A1-DAY(A1-1)-1 (subtract from A1 the number of days in the prior month,
plus 1)

"user@msn" wrote:

I need a formula that will return the last day of the month for a period of
two months prior to the date I enter. For example, if I enter 1/1/08 in Cell
A1, I want Cell B1 to return 11/30/07; if I enter 2/1/08 in Cell A1, I want
Cell B1 to return 12/31/07, etc..

P.S. Cell A1 will always be the first day of the month (if that matters)

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default date calculation

On Wed, 12 Dec 2007 10:41:04 -0800, user@msn
wrote:

I need a formula that will return the last day of the month for a period of
two months prior to the date I enter. For example, if I enter 1/1/08 in Cell
A1, I want Cell B1 to return 11/30/07; if I enter 2/1/08 in Cell A1, I want
Cell B1 to return 12/31/07, etc..

P.S. Cell A1 will always be the first day of the month (if that matters)

Thanks



=A1-DAY(A1)-DAY(A1-DAY(A1))

and it doesn't matter what day of the month is in A1.
--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
Date Calculation AndyO_UK Excel Worksheet Functions 2 December 6th 06 11:07 AM
Tricky Date calculation: How to calculate a future date [email protected] Excel Discussion (Misc queries) 9 August 11th 06 04:24 AM
Date Calculation Alpur Excel Discussion (Misc queries) 0 November 15th 05 02:38 PM
Date calculation Box666 New Users to Excel 3 November 4th 05 02:11 PM
Date calculation USCBrad Excel Worksheet Functions 3 June 21st 05 04:03 PM


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