Advance A Date By Month Or Year

M

Minitman

Greetings,

I have three cells. The first (A1) has a month listing and the
second (B1) has a year listing. I have CommandButtons to change the
months and the years, just not the code to make them work.

Any help would be appreciated.

TIA

-Minitman
 
D

Dave D-C

Minitman said:
I have three cells. The first (A1) has a month listing and the
second (B1) has a year listing. I have CommandButtons to change the
months and the years, just not the code to make them work.

Is your question what to do with months > 12?:
NewYear = OldYear + AddYears + (OldMonth + AddMonths-1) \ 12
NewMonth = 1 + (OldMonth + AddMonths - 1) mod 12
or, if you've already got the old..+add..= new..
NewYear = NewYear + (NewMonth-1) \ 12
NewMonth = 1 + (NewMonth - 1) mod 12
 
M

Minitman

Thanks Dave,

I appreciate the reply, but that's not what I was looking for. It
turns out all I needed was to look deeper into the TEXT() command and
I came up with this where E3 is the date entry cell:

=TEXT(E3+30, "mmm")&" 20, "&TEXT(E3+30, "yyyy")

-Minitman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top