Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I am trying to use an if then else to print out a year whose value is dependent on the if condition.
Specifically, if the current month is greater than July, I want to print out the current year plus 2 years. If the current month is less than July, I want to print out the current year plus 3 years.
A similar conditional that IS working is shown here:
{ IF MONTH(DATE) < 7 "JULY" "JANUARY" }
This prints out July or January depending on whether or not the current month is less than July (the 7th month).
So, the difference between this one and the one I need to make is that the output is not static, as the words "July" and "January" are. The then and else actions should actually call functions that return the current year (plus 2 or 3).
Any ideas??

What language is this code written in? It certainly doesn't look like VBA for MS Word, which is what most macros are written in.

it's the mail merge syntax, but I'm not sure how to get it working correctly. My cheating method would be to put it in the source Excel file as a formula, but I'd imagine you've tried that route already!

Try this site. It contains an example that sounds similiar to yours.
http://www.addbalance.com/usersguid...
Navigate to the site and then use Ctrl F to search for current year
Directly above the example for Date Fields is a discussion on Nested If's. Perhaps between the 2 of those techniques you can come up with a solution.
Good luck.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |