Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Error calculating date

hi,

please help me to resolve this issue, the following formula works fine till
31 Dec 2005, when year changes to 2006 it just stop caculating the date,
formula I'm using to caculate date & year is:
=IF(YEAR($E$2)-YEAR(E9)=2,IF(12-MONTH(E9)0,12-MONTH(E9)+IF(DAY($E$2)=DAY(E9),MONTH($E$2),0),MON TH($E$2)),0)



Date 25/01/2007 (<--- This is the current date)

D 28 December 2005 P5 1
D 01 December 2005 P3 1
D 15 December 2005 P4 1
D 13 January 2006 P4 0 (<----This Value always came wrong)
D 25 October 2005 P2 3
D 01 December 2005 P5 1
D 29 October 2005 P5 2
D 22 December 2005 P1 1
D 31 December 2005 P3 1


Please help me out...
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,886
Default Error calculating date

Hi

It gives 0 because it fails on the first test
Year($E$2)-Year(E9) =1

Maybe you could use
=MIN(12,MONTH(E2)-MONTH(E9)+12)

--
Regards

Roger Govier


"Attie" wrote in message
...
hi,

please help me to resolve this issue, the following formula works fine
till
31 Dec 2005, when year changes to 2006 it just stop caculating the
date,
formula I'm using to caculate date & year is:
=IF(YEAR($E$2)-YEAR(E9)=2,IF(12-MONTH(E9)0,12-MONTH(E9)+IF(DAY($E$2)=DAY(E9),MONTH($E$2),0),MON TH($E$2)),0)



Date 25/01/2007 (<--- This is the current date)

D 28 December 2005 P5 1
D 01 December 2005 P3 1
D 15 December 2005 P4 1
D 13 January 2006 P4 0 (<----This Value always came
wrong)
D 25 October 2005 P2 3
D 01 December 2005 P5 1
D 29 October 2005 P5 2
D 22 December 2005 P1 1
D 31 December 2005 P3 1


Please help me out...



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
IF and Date Functions Christ4 Excel Worksheet Functions 3 August 11th 06 04:18 AM
insert date Larry Excel Worksheet Functions 28 July 15th 06 02:41 AM
Insert Automatic, Non-Updating Date Stamp Ken Zenachon Excel Discussion (Misc queries) 8 January 18th 06 06:52 PM
Need to Improve Code Copying/Pasting Between Workbooks David Excel Discussion (Misc queries) 1 January 6th 06 03:56 AM
Another Date issue. TimM Excel Worksheet Functions 1 November 17th 05 01:58 AM


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