Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
wfactor
 
Posts: n/a
Default dates, 1 month prior


Hi all,

examples of what I need, can someone assist?

Date provided = 21/05/06
I need excel to provide the date: 22/04/06

Date provided = 31/07/06
I need excel to provide the date: 01/07/06

Date provided = 01/06/06
I need excel to provide the date: 02/05/06


Thanks


--
wfactor
------------------------------------------------------------------------
wfactor's Profile: http://www.excelforum.com/member.php...o&userid=35548
View this thread: http://www.excelforum.com/showthread...hreadid=553104

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max
 
Posts: n/a
Default dates, 1 month prior

Presuming that, for consistency with the other 2 examples,
the date needed in your lines:

Date provided = 31/07/06
I need excel to provide the date: 01/07/06


is 02/07/06

then this would suffice ..

Assuming source dates are in A1 down
In B1: =DATE(YEAR(A1),MONTH(A1)-1,DAY(A1)+1)
Copy B1 down
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"wfactor" wrote:

Hi all,

examples of what I need, can someone assist?

Date provided = 21/05/06
I need excel to provide the date: 22/04/06

Date provided = 31/07/06
I need excel to provide the date: 01/07/06

Date provided = 01/06/06
I need excel to provide the date: 02/05/06


Thanks


--
wfactor
------------------------------------------------------------------------
wfactor's Profile: http://www.excelforum.com/member.php...o&userid=35548
View this thread: http://www.excelforum.com/showthread...hreadid=553104


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
wfactor
 
Posts: n/a
Default dates, 1 month prior


it doesn't fully work..

march 28 - 31
if the provided date is the 31st, and the month prior doesn't have 31
days then it also causes the wrong new date to show

provided date your formula date
4/01/2007 5/12/2006 (correct)
1/01/2007 2/12/2006 (correct)
31/03/2007 4/03/2007 (should be 01/03/07)
31/12/2006 2/12/2006 (should be 01/12/06)


--
wfactor
------------------------------------------------------------------------
wfactor's Profile: http://www.excelforum.com/member.php...o&userid=35548
View this thread: http://www.excelforum.com/showthread...hreadid=553104

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max
 
Posts: n/a
Default dates, 1 month prior

it doesn't fully work..

Yes, but that was the stated presumption / caveat in the earlier response ..

Try instead in B1, copied down:
=IF(DATE(YEAR(A1),MONTH(A1),DAY(A1)+1)=DATE(YEAR(A 1),MONTH(A1)+1,1),DATE(YEAR(A1),MONTH(A1),1),DATE( YEAR(A1),MONTH(A1)-1,DAY(A1)+1))

--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"wfactor" wrote:

it doesn't fully work..

march 28 - 31
if the provided date is the 31st, and the month prior doesn't have 31
days then it also causes the wrong new date to show

provided date your formula date
4/01/2007 5/12/2006 (correct)
1/01/2007 2/12/2006 (correct)
31/03/2007 4/03/2007 (should be 01/03/07)
31/12/2006 2/12/2006 (should be 01/12/06)


--
wfactor
------------------------------------------------------------------------
wfactor's Profile: http://www.excelforum.com/member.php...o&userid=35548
View this thread: http://www.excelforum.com/showthread...hreadid=553104


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ardus Petus
 
Posts: n/a
Default dates, 1 month prior

=IF(DAY(A1)DAY(DATE(YEAR(A1),MONTH(A1),0)),DATE(Y EAR(A1),MONTH(A1),1),DATE(YEAR(A1),MONTH(A1)-1,DAY(A1)+1))

HTH
--
AP

"Max" a écrit dans le message de news:
...
it doesn't fully work..


Yes, but that was the stated presumption / caveat in the earlier response
..

Try instead in B1, copied down:
=IF(DATE(YEAR(A1),MONTH(A1),DAY(A1)+1)=DATE(YEAR(A 1),MONTH(A1)+1,1),DATE(YEAR(A1),MONTH(A1),1),DATE( YEAR(A1),MONTH(A1)-1,DAY(A1)+1))

--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"wfactor" wrote:

it doesn't fully work..

march 28 - 31
if the provided date is the 31st, and the month prior doesn't have 31
days then it also causes the wrong new date to show

provided date your formula date
4/01/2007 5/12/2006 (correct)
1/01/2007 2/12/2006 (correct)
31/03/2007 4/03/2007 (should be 01/03/07)
31/12/2006 2/12/2006 (should be 01/12/06)


--
wfactor
------------------------------------------------------------------------
wfactor's Profile:
http://www.excelforum.com/member.php...o&userid=35548
View this thread:
http://www.excelforum.com/showthread...hreadid=553104






  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max
 
Posts: n/a
Default dates, 1 month prior

"Ardus Petus" wrote:
=IF(DAY(A1)DAY(DATE(YEAR(A1),MONTH(A1),0)),DATE(Y EAR(A1),MONTH(A1),1),DATE(YEAR(A1),MONTH(A1)-1,DAY(A1)+1))


Think the above seems to fail with, say: 30 Apr 2006 (last day of the month,
irrespective). The formula returns: 31 Mar 2006 (instead of 1 Apr 2006) in my
tests here. Same error results as well if it's 28 Feb 2006 (returns 29 Jan
2006, instead of 1 Feb 2006). I'm of course extending the interp on the OP to
assume that OP wants it to behave like that for the last day of the month,
irrespective of how many days the month may have.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
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
calculating number of three month periods between two dates... neil Excel Discussion (Misc queries) 3 May 21st 06 01:52 PM
Pivot table - group dates per week or month digicat Excel Discussion (Misc queries) 1 January 8th 06 08:46 PM
Dates of a Day for a month & year cell formulas mikeburg Excel Discussion (Misc queries) 2 December 29th 05 10:14 PM
Prior Month Howard Excel Discussion (Misc queries) 6 November 2nd 05 03:06 PM
sort dates by month and day not year dianne Excel Worksheet Functions 2 March 8th 05 08:16 PM


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