# Simulate month

#### most

##### Board Regular
I have a problem and need some input from some clever people.
I have some code which does something based on which month it is.

Coloumn 1 - - - - - - - - - - - - - - -Column 2
=MONTH(TODAY())+Z2 - - - - - - -[some code based on the number in column 1, expect number 1-12]

Cell Z2 I use to simulate another month, if it's January and I would like to see February I put in a "1" in Z2. I use a macro to increase or decrease this figure.
Range("Z2") = Range("Z2") - 1
Range("Z2") = Range("Z2") + 1

This works fine for most month of the year, the problem is at turn of the year.
December and I want to see January -> 12+1 = 13 (expect 1)
January and I want to see November -> 1--2 = -1 (expect 11)

Any idea how I can solve this?

regards Marcus

Last edited:

### Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
This will always give you the month number of next month:

=MONTH(EDATE(TODAY(),1))

This will always give you the month number of next month:

=MONTH(EDATE(TODAY(),1))

even Jan >> November !

Then it would be -2!

This will always give you the month number of next month:

=MONTH(EDATE(TODAY(),1))

In this case it will be something like:
Code:
``=MONTH(EDATE(TODAY(),Z2))``

Code:
``[/FONT]=MONTH(EDATE(TODAY(),Z2))``
Works like a charm, thanks!

Replies
7
Views
108
Replies
7
Views
305
Replies
4
Views
402
Replies
6
Views
1K
Replies
1
Views
259

1,203,171
Messages
6,053,876
Members
444,692
Latest member
Queendom

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back