Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

excel if statement syntax

Posted on 2016-09-29
Medium Priority
61 Views
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?
0
Question by:maqskywalker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 27

Accepted Solution

Glenn Ray earned 1004 total points
ID: 41821650
You'll just replace the xxx=xxx portion with another logic test, like so:
=If (MONTH (TODAY ())<=6,2016,2017)
0

LVL 17

Assisted Solution

Barry Cunney earned 332 total points
ID: 41821656
=IF(AND(MONTH(TODAY)<=6,MONTH(TODAY)>=1),2016,2017)
0

LVL 33

Assisted Solution

Rob Henson earned 332 total points
ID: 41821737
For future compatibility:

=IF(MONTH(TODAY())<=6,YEAR(TODAY()),YEAR(TODAY())+1)
1

LVL 35

Assisted Solution

Norie earned 332 total points
ID: 41821854
Try this.

=YEAR(TODAY())+(MONTH(TODAY()>6)
0

LVL 1

Author Comment

ID: 41822696
thanks
0

LVL 1

Author Closing Comment

ID: 41822698
thanks
0

Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Suggested Courses
Course of the Month9 days, 10 hours left to enroll