ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   MONTH INCREMENT FORMULA (https://www.excelbanter.com/excel-discussion-misc-queries/155422-month-increment-formula.html)

deepak bsg[_2_]

MONTH INCREMENT FORMULA
 
My button contains month & year (i.e., apr-07,may-07....mar-08). If i
select a particular month in the button (eg: Aug-07). I should get
the total no.of months starting from apr-07 to aug-07 i.e., 5 months. Hence i
require a formula to get the total no of months as explained above.


With the help of your fomula i'll extract the data from another sheet.
Thanks in advance.

OssieMac

MONTH INCREMENT FORMULA
 
Hi Deepak,

Try this and see if it meets your requirements:-

=MONTH("aug 2007")-MONTH("apr 2007")+1

I included the +1 because your result of 5 in your request indicated that
you probably want to include both the months.

The same function can be used on a worksheet and in VBA code.

Regards,

OssieMac


"deepak bsg" wrote:

My button contains month & year (i.e., apr-07,may-07....mar-08). If i
select a particular month in the button (eg: Aug-07). I should get
the total no.of months starting from apr-07 to aug-07 i.e., 5 months. Hence i
require a formula to get the total no of months as explained above.


With the help of your fomula i'll extract the data from another sheet.
Thanks in advance.


Toppers

MONTH INCREMENT FORMULA
 
Assuming the data is text i.e. the caption on the button [FORMS/CONTROL
toolbox?], then one way:

Create table as below which I called "MyMonths"

Apr 1
May 2
Jun 3
Jul 4
Aug 5
Sep 6
Oct 7
Nov 8
Dec 9
Jan 10
Feb 11
Mar 12

then formula is:

=VLOOKUP(LEFT(A1,3),MyMonths,2,0)

where A1 is your button text.


"deepak bsg" wrote:

My button contains month & year (i.e., apr-07,may-07....mar-08). If i
select a particular month in the button (eg: Aug-07). I should get
the total no.of months starting from apr-07 to aug-07 i.e., 5 months. Hence i
require a formula to get the total no of months as explained above.


With the help of your fomula i'll extract the data from another sheet.
Thanks in advance.


deepak bsg[_2_]

MONTH INCREMENT FORMULA
 
Thanks for your prompt reply. It is working.

Thankyou very much.

"OssieMac" wrote:

Hi Deepak,

Try this and see if it meets your requirements:-

=MONTH("aug 2007")-MONTH("apr 2007")+1

I included the +1 because your result of 5 in your request indicated that
you probably want to include both the months.

The same function can be used on a worksheet and in VBA code.

Regards,

OssieMac


"deepak bsg" wrote:

My button contains month & year (i.e., apr-07,may-07....mar-08). If i
select a particular month in the button (eg: Aug-07). I should get
the total no.of months starting from apr-07 to aug-07 i.e., 5 months. Hence i
require a formula to get the total no of months as explained above.


With the help of your fomula i'll extract the data from another sheet.
Thanks in advance.



All times are GMT +1. The time now is 12:42 AM.

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