ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Deduct Months from a Date (https://www.excelbanter.com/excel-worksheet-functions/157469-deduct-months-date.html)

DaveMoore

Deduct Months from a Date
 
In Column 'D' I have a list of dates in the form MMMM/YYY
Column 'E' contains whole numbers which represent a no. of months
In column 'F' I wish to deduct the number of months in 'E' from 'D'

Can anyone help?


Mike H

Deduct Months from a Date
 
Maybe

=DATE(YEAR(D1),MONTH(D1)-E1,DAY(D1))

Mike

"DaveMoore" wrote:

In Column 'D' I have a list of dates in the form MMMM/YYY
Column 'E' contains whole numbers which represent a no. of months
In column 'F' I wish to deduct the number of months in 'E' from 'D'

Can anyone help?



Boris[_2_]

Deduct Months from a Date
 
On Fri, 07 Sep 2007 06:05:44 -0700, DaveMoore wrote:

In Column 'D' I have a list of dates in the form MMMM/YYY
Column 'E' contains whole numbers which represent a no. of months
In column 'F' I wish to deduct the number of months in 'E' from 'D'

Can anyone help?


Use this function:
---
Function MonthAdd(dDate As Variant, nMonth As Variant) As Variant
MonthAdd = DateAdd("m", nMonth, dDate)
End Function
---

In worksheet use =MONTHADD(D5,E5)
This function will add months to your date, and if you want it to subtract,
just call it with negative argument for month: =MONTHADD(D5,-E5)

Regards,
B.

Rick Rothstein \(MVP - VB\)

Deduct Months from a Date
 
In Column 'D' I have a list of dates in the form MMMM/YYY
Column 'E' contains whole numbers which represent a no. of months
In column 'F' I wish to deduct the number of months in 'E' from 'D'


Do you really have a 3-digit year? If so, is that the format you want your
answer in? Also, again assuming you really have a 3-digit year, what is the
earliest year your date can have (I'm trying to see if you have to have
logic to handle 19xx type years)?

Rick


DaveMoore

Deduct Months from a Date
 
On 7 Sep, 14:05, DaveMoore wrote:
In Column 'D' I have a list of dates in the form MMMM/YYY
Column 'E' contains whole numbers which represent a no. of months
In column 'F' I wish to deduct the number of months in 'E' from 'D'

Can anyone help?


Thank you both Mike & Boris.
Playing around I found that EOMONTH worked also
Dave Moore


DaveMoore

Deduct Months from a Date
 
On 7 Sep, 14:42, "Rick Rothstein \(MVP - VB\)"
wrote:
In Column 'D' I have a list of dates in the form MMMM/YYY
Column 'E' contains whole numbers which represent a no. of months
In column 'F' I wish to deduct the number of months in 'E' from 'D'


Do you really have a 3-digit year? If so, is that the format you want your
answer in? Also, again assuming you really have a 3-digit year, what is the
earliest year your date can have (I'm trying to see if you have to have
logic to handle 19xx type years)?

Rick


My mistake Rick. The format is in fact MMMM YYYY so today's date
would return September 2007.
Dates in my list in column 'D' are all later than the year 2000
although the result in column 'F. may well be 19xx.
As mentioned in my mail that crossed with yours I used EOMONTH
successfully.
Thanks very much,
Dave Moore


Balan

Deduct Months from a Date
 
Mr.Dave,
I am happy you are satisfied that EOMonth worked as well. But I notice that
the results of EOMONTH and the suggestions given by Mike and Boris would be
different. I am thankful that I have come to know about EOMONTH from your
reply.

I am a novice to formulae and programming. From Boris I would like to get
one clarification . DateAdd is not defined but it is working-- how ? I do
not find any excel worksheet function called Dateadd. Further, what "m"
inside the brackets of dateadd indicate -- months ? Is dateadd a function of
VBA ? I shall be grateful for these clarifications.

Balan

"DaveMoore" wrote:

On 7 Sep, 14:05, DaveMoore wrote:
In Column 'D' I have a list of dates in the form MMMM/YYY
Column 'E' contains whole numbers which represent a no. of months
In column 'F' I wish to deduct the number of months in 'E' from 'D'

Can anyone help?


Thank you both Mike & Boris.
Playing around I found that EOMONTH worked also
Dave Moore




All times are GMT +1. The time now is 12:52 PM.

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