excel if statement syntax

Hi experts,

I'm using Excel 2013.

Today’s date is 9/29/2016

In excel the following formula gives me the month part of today’s date. So it gives me 9.
=MONTH(TODAY())

In excel the following formula gives me the year part of today’s date. So it gives me 2016
=YEAR(TODAY())

In excel the syntax for an if statement is like this

=IF(statement,ifstatementistruedothis,ifstatementisfalsedothis)


I'm working on an if statement.
This is the logic for the if statement I need.

If the month part of today’s date equals 1,2,3,4,5,6
           then set the year to 2016
Else  If the month part of today’s date equals 7,8,9,10,11,12
          then set the year to 2017

So far this is what I have. In the part where i put xxx that's the part I need help with.

=IF(xxx=xxx,2016,2017)

Anyone the syntax for the if statement mentioned above?
LVL 1
maqskywalkerAsked:
Who is Participating?
 
Glenn RayExcel VBA DeveloperCommented:
You'll just replace the xxx=xxx portion with another logic test, like so:
=If (MONTH (TODAY ())<=6,2016,2017)
0
 
Barry CunneyCommented:
=IF(AND(MONTH(TODAY)<=6,MONTH(TODAY)>=1),2016,2017)
0
 
Rob HensonFinance AnalystCommented:
For future compatibility:

=IF(MONTH(TODAY())<=6,YEAR(TODAY()),YEAR(TODAY())+1)
1
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
NorieVBA ExpertCommented:
Try this.

=YEAR(TODAY())+(MONTH(TODAY()>6)
0
 
maqskywalkerAuthor Commented:
thanks
0
 
maqskywalkerAuthor Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.