Excel IF Statement Explained

Excel 2007 – IF Statement Explained

by on August 25, 2010

in Excel,Microsoft Office Training,Online Training

Watch the video extract as seen on YouTube, then read the full tutorial below.

Click the Full Screen button on the player to watch it in HD.

To get the full video with bonus tips for using IF Statements sign up for our free Microsoft Office Online Training.

Excel IF Statements Explained

In this Microsoft Office Online Training tutorial we’re going to explain how to use the IF Formula, and look at a couple of different applications for it.

With the IF formula you can tell Excel to perform different calculations depending on whether the answer to your question is true of false.

The function wizard in Excel describes the IF Formula as:

= IF(logical_test,value_if_true,value_if_false)

But let’s translate it into English and apply it to an example:

In the table below we want to calculate a commission in column G for each Builder based on the number of units in column D.

Excel-IF-Statements-Explained

We’ll say that for units over 5 we’ll pay 10% commission based on the Total $k figure in column F, and for units of 5 and under we’ll pay 5% commission.

Our IF formula for row 2 would read like this:

=IF(The number of units in cell D2 is >5,Then take the Total $k in cell F2 x 10%, but if it’s not > 5 then take the Total $k in cell F2 x 5%)

The actual formula we would enter into Cell G2 would be:

=IF(D2>5,F2*10%,F2*5%)

Remember; as the number of units in row 5 is not greater than 5 the formula would calculate a 5% commission.

Other applications of the Excel IF statement

We don’t have to use the IF statement to perform a calculation.  We could use it to return a comment.   If we take the previous example again, we could have asked Excel to put a note in the cell like ‘Pay 5%’ or ‘Pay 10%’.  To do this our formula would look like this:

=IF(D2>5,Pay 10%,Pay 5%)

Notice the difference between the two formulas is the inverted commas () surrounding the results we want Excel to produce.  These inverted commas tell Excel that the information between them is to be entered as text.

Below is a screen shot of how the formula looks in the Formula Bar and the result returned in column G.

Excel-IF-Statements-Explained

Try other operators in your IF statements

Because the IF formula is based on logic, you can employ tests other than the greater than (>) operator used in the example above.

Other operators you could use are:

  • =             Equal to
  • <             Less Than
  • <=           Less than or equal to
  • >=           Greater than or equal to (if we’d used this operator in our above example row 5 which had 5 units would have returned Pay 10%)
  • <>           Less than or greater than

Now practice.  Copy and paste the formulas used in these examples into your workbooks to practice, or download the spreadsheet used in the example above.

Click here to get more free Microsoft Office online training and video tutorials from My Online Training Hub. 

If you like the IF statement, take a look at our tutorials on SUMIF and SUMIFS Formulas Explained and COUNTIF and COUNTIFS Formulas Explained.

Did you find this useful, or did it just confuse you?  Let us have your comments below.

Want more on Excel? Sign up for our newsletter below and receive weekly tips & tricks to your inbox, plus you’ll get our 100 Excel Tips & Tricks e-book.

FREE PDF Download
100 Excel Tips & Tricks

Excel Tips & Tricks E-Book
Just enter your details below

Leave a Comment

{ 25 comments… read them below or add one }

Conor September 1, 2010 at 1:36 pm

excellent explanation, thanks very much, just what I was looking for

Conor

Reply

Ahmed Ahmed September 13, 2010 at 9:47 am

good job. thanx for your efforts, it was very helpful to me to read this page

Reply

Mynda September 29, 2010 at 8:39 pm

@Conor – thanks for your feedback.

@Ahmed Ahmed – Glad I could help.

Reply

godofgore November 25, 2010 at 4:35 pm

cool explanation, if only eveything was this well explained.

Reply

Excel Statement April 21, 2011 at 5:04 am

I agree, I once had problems trying to nest IF functions but this cleared them up.

Reply

harshman insurance October 5, 2010 at 5:03 pm

This is the BEST page I have read all week!!!

Reply

Philip Treacy October 6, 2010 at 10:56 am

Thx! :) Glad you enjoyed it

Reply

magnific November 1, 2010 at 5:52 pm

this is the way a blog should be! thanks!

Reply

Mynda November 2, 2010 at 1:58 pm

Thanks. Glad we could help.

Reply

Debbi November 8, 2010 at 3:52 pm

thanks. I’ll try using other operators as you suggest

Debbi

Reply

Romeo Levanza Jr. February 17, 2011 at 10:42 pm

I really appreciate your tutorial video.

God Bless,

Reply

Mia Baum April 30, 2011 at 5:58 am

Extremely helpful…this 4 minute video must have just saved me 3 hours. Thanks.

Reply

Mynda April 30, 2011 at 2:32 pm

Thanks, Mia. Glad we could help.

Reply

vickie October 4, 2011 at 2:46 am

great stuff!

Reply

Mynda Treacy October 4, 2011 at 9:13 pm

Cheers Vickie. I appreciate your feedback.

Reply

charles December 23, 2011 at 2:43 am

how do I test to see if a number falls within a range and how do I write the formula? should I use the IF AND function?

Reply

Mynda Treacy December 23, 2011 at 7:52 pm

Hi Charles,

You could use a formula like this:

=IF(AND(A1>=5,A1<=10),"TRUE","FALSE")

Which says, IF the value in cell A1 is between 5 and 10 then return 'TRUE', if not return'FALSE'.

I hope that's what you're after.

Kind regards,

Mynda.

Reply

Ashit Shroff February 24, 2012 at 3:32 am

Cool stuff very useful.
Explained clearly and nicely.
Thanks.

Reply

Mynda Treacy February 24, 2012 at 8:52 am

Cheers, Ashit :)

Reply

Rose Tegg March 20, 2012 at 8:27 am

I am learning so much, your explanations are very easy to follow. I have enjoyed doing the learning the IF statement. Thank you

Reply

Mynda Treacy March 21, 2012 at 4:48 pm

Thanks, Rose :)

Reply

faisal bashir April 13, 2012 at 4:12 am

Video tutorial is the most effective way of learning with enjoyment.
Thank you so very much Mynda treacy and team for your excellent vision, efforts and the lust to spread knowledge.

Wishing you all the best

Regards,
Faisal Bashir.

Reply

Mynda Treacy April 17, 2012 at 9:43 pm

Thanks Faisal. I sincerely appreciate your kind words.

Mynda.

Reply

Mohammed Shukur Sheikh May 1, 2012 at 5:00 am

Sir, It is good and excellent explained and I would like to say nobody explain like this.And further I hope you would explain all the difficult problems and the equations speciaaly

Reply

Mynda Treacy May 1, 2012 at 9:19 am

Thanks, Mohammed :)

Reply

Previous post:

Next post: