Solved

excel if statement syntax

Posted on 2016-09-29
6
49 Views
Last Modified: 2016-09-29
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
Comment
Question by:maqskywalker
6 Comments
 
LVL 27

Accepted Solution

by:
Glenn Ray earned 251 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

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

Assisted Solution

by:Rob Henson
Rob Henson earned 83 total points
ID: 41821737
For future compatibility:

=IF(MONTH(TODAY())<=6,YEAR(TODAY()),YEAR(TODAY())+1)
1
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 33

Assisted Solution

by:Norie
Norie earned 83 total points
ID: 41821854
Try this.

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

Author Comment

by:maqskywalker
ID: 41822696
thanks
0
 
LVL 1

Author Closing Comment

by:maqskywalker
ID: 41822698
thanks
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question