2015 Calendar in Excel

The IF function

The IF function is very useful in Excel and it can be used in a number of ways.

I have used a screenshot and example formulas from the 2015 Calendar xlsx to illustrate the use of the IF Function.

2015 Calendar in Excel
2015 Calendar in Excel

How does the IF Function work?

If we wrote the function out as a sentence, it would probably be close to this:

If this is true, do this. If this is false, do that.

In the photo above you can see that Excel uses letters for the columns (A,B,C,D) and numbers for the Rows (1,2,3,4). A1 means the first column and the first row. It tells Excel which cell to look at, like an address.

If we wrote the function out in Excel, it would look like this.

=IF(Days!C2=A2,A1,””)

Days! Means the worksheet called 'Days' and C2 is the cell on that sheet.
Day!C2 = Sunday
A2 = Sunday
A1, January 1
"" = blank
This would roughly read as:
If this is Sunday, and that is Sunday, show the date ‘January 1.’ If this is Sunday and that is not Sunday, show nothing.

Multiple IF Functions

You can use more than 1 IF function. You can create a series of conditions.

This is an example formula taken from the calendar.
=IF(Days!C2=D2,A1, IF(Days!C2=A2, A3+3, IF(Days!C2=B2, B3+2, IF(Days!C2=C2, C3+1, IF(G3=A1, (A1-3), IF(F3=A1, (A1-2), IF(E3=A1,(A1-1),””)))))))

This formula is used to calculate which date should be shown in the cell.

If we wrote a formula like this out as a sentence, it would probably be close to this:

If this is true, do this. If this is true, do this. If this is true, do this. If this is true, do this. If this is true, do this. If this is true, do this. If this is true, do this. If these are false, do that.

As you can see, there are 7 true statements, but only 1 false statement is needed.

For further help with the IF Function, read this article from the Microsoft webpage.
I hope this brief introduction to the IF Function has helped.
Take care!

 

One thought on “The IF function

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s