Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Using the IF Worksheet Function.

Using the IF Worksheet Function

Written by Allen Wyatt (last updated March 11, 2025)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and 2021


1

Excel provides a wide range of worksheet functions you can use. One of the most versatile worksheet functions is IF. This function allows you to test some condition, and then use a value if the condition is true or a different value if the condition is false. For instance, consider the following example:

=IF(A2<C2,"Too low","")

Notice that IF requires three arguments, each separated by commas. The first argument (in this example, A2<C2) is the conditional test. If the test proves true, then the second argument (in this case, the test string "Too low") is used. If the test proves false, then the third argument (in this case, an empty string) is used. In other words, if the value in cell A2 is lower than the value in cell C2, then this formula returns the string "Too low." Otherwise, it returns an empty string.

You are not limited, of course, to returning strings in an IF function. You can return any value you want, including the values stored in other cells. For example:

=IF(A2<C2,B6-B7,43)

In this case, if A2 is less than C2, then the value derived by subtracting B7 from B6 is returned. If A2 is not less than C2, then the value 43 is returned.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10423) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and 2021. You can find a version of this tip for the older menu interface of Excel here: Using the IF Worksheet Function.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Can't Get Rid of Unwanted Recovery File

Sometimes Word can get confused, and it may think that it needs to recover files that you are sure no longer exist. If ...

Discover More

Adding Differently Formatted Text to a Cell

Want to add or replace some text in a column with text that is formatted differently? The ideas presented in this tip can ...

Discover More

Splitting Table Cells

When formatting tables, you can both merge and split cells. Here's a couple of ways you can easily perform the latter ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Returning Blanks or Asterisks from a Lookup

Want to return more than a value when doing a lookup? Here are a couple of ways to do it by adding an IF clause to your ...

Discover More

Converting to Other Number Systems

Most calculations are done using the decimal numbering system. If you need to convert your decimal values to a differing ...

Discover More

Ways to Concatenate Values

Users of the most recent versions of Excel have four different ways available to combine values into strings. Even those ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 + 9?

2025-03-11 07:49:57

jamies

And ..
there is a limit to the nesting depth - not least of which is working through the bracketted pairs -
so Excel now allows formulas to be split on entry - so you can have the separate bits of logic on separate lines in the formula entry area.
And - you can also use concatenation of multiple steps - as in
=IF(logical test group1)&IF(logical test group2)&IF(logical test group3)
with the results from failed (logical test groups) being either "", 0, or void and optionally added together or multiplied - for AND and OR effects
so combining the multiple answer sets to get a single result.

And there is the new LET() to make the logic easier - as in specify a name for the result of a logical test group, calculation, or text string

Not forgetting the simple =""&IF(test,"Cell",) to get the False result showing as nothing rather than a numeric 0.

And - for tidy presentation - there is the Formatting facility "Custom"to add commentary entries to the displayed/printed presentation of a value
Google the MS specifications of formatting codes


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.