ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date Calculation Problem (https://www.excelbanter.com/excel-programming/338741-date-calculation-problem.html)

bperks

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
************


Tom Ogilvy

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
************




George Nicholson[_2_]

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
************





All times are GMT +1. The time now is 06:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com