Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Date Calculation Problem

I am trying to figure out how to take a date (01/01/05) in A1, and
months in A2 (the months could vary from 12 all the way up to 60)and
have A3 show me the actual date format of 01/01/05 + 60 months =
01/01/10 or whatever it would be due to the leap years and all. Needs
to be triggered by input from A2. Thanks in advance for any help!!!!


Effective Date (A1) 01/01/05
Term in Months (A2) 60
Expiration Date (A3) ________


************
bperks
Excel 2002
USA
************

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Date Calculation Problem

=Date(Year(A1),Month(A1)+A2+1,0)

Would give you the end of the month


=Date(Year(A1),Month(A1)+A2,1)

Would give you the first of the month.

--
Regards,
Tom Ogilvy


"bperks" wrote in message
oups.com...
I am trying to figure out how to take a date (01/01/05) in A1, and
months in A2 (the months could vary from 12 all the way up to 60)and
have A3 show me the actual date format of 01/01/05 + 60 months =
01/01/10 or whatever it would be due to the leap years and all. Needs
to be triggered by input from A2. Thanks in advance for any help!!!!


Effective Date (A1) 01/01/05
Term in Months (A2) 60
Expiration Date (A3) ________


************
bperks
Excel 2002
USA
************



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 170
Default Date Calculation Problem

for a formula in a worksheet (in cell A3):
= Date(Year(A1), Month(A1)+ A2, Day(A1))

in VBA:
(In the Worksheet_Change event):

Select Case Target.Address
Case "$A$2"
Range("A3") = DateAdd("m", Range("A2"), Range("A1"))
Case Else
'Do nothing
End Select

or, if you wanted this to trigger whenever a value in row 2 changes (not
just A2):

Select Case Target.Row
Case 2
Target.Offset(1,0) = DateAdd("m", Target, Target.Offset(-1,0))
Case Else
'Do nothing
End Select

HTH,

--
George Nicholson

Remove 'Junk' from return address.


"bperks" wrote in message
oups.com...
I am trying to figure out how to take a date (01/01/05) in A1, and
months in A2 (the months could vary from 12 all the way up to 60)and
have A3 show me the actual date format of 01/01/05 + 60 months =
01/01/10 or whatever it would be due to the leap years and all. Needs
to be triggered by input from A2. Thanks in advance for any help!!!!


Effective Date (A1) 01/01/05
Term in Months (A2) 60
Expiration Date (A3) ________


************
bperks
Excel 2002
USA
************



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 problem petedacook Excel Worksheet Functions 3 March 24th 10 02:08 PM
Date Calculation problem wins007 Excel Discussion (Misc queries) 4 June 22nd 09 03:28 PM
Date Calculation Problem Homer Excel Worksheet Functions 9 December 30th 06 08:54 PM
Date Calculation Problem RFrechette Excel Discussion (Misc queries) 4 November 22nd 06 07:31 PM
Coding to show first _weekday_ prior to a date, when date calculation happens to fall on weekend? StargateFan[_3_] Excel Programming 5 December 9th 04 09:06 AM


All times are GMT +1. The time now is 09:57 PM.

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"