• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Microsoft Excel Tips and Tricks - Computergaga

  • Home
  • Excel Online Courses
  • Excel Functions List
  • Free Downloads
  • Blog
  • Tutorials
  • About

Excel IF Function

The IF function tests a condition and takes an alternative action depending on the result. It is a logical function and gets Excel to think for itself.

For example, if the sales total in cell B4 is higher than £1500 then calculate the commission, and if not then leave the value as it is.

The IF function can only test one condition. Because of this limitation, it is often combined with other functions like AND and OR that can check multiple conditions.

The syntax for the IF function is:

=IF(logical_test, [value_if_true], [value_if_false])

ArgumentPurpose
Logical_testThe condition to be tested
Value_if_trueThe action to be taken if the result is true
Value_if_falseThe action to be taken if the result is false

Logical operators

Conditions are tested using logical operators.

OperatorActionExampleResult
=Equals To5=5True
>Greater Than10>5True
<Less Than10<5False
>=Greater Than or Equal To10>=8False
<=Less Than or Equal To10<=10True
<>Not Equals To10><10False

IF function examples

Cell B4FunctionResult
1600=IF(B4>=1500, “Well done”, “Unlucky”)Well done
1050=IF(B4>=1500, B4*0.1, B4)1050
50=IF(B4=200, “Bingo”, 0)0
2000=IF(B4>1500, B4-B4*0.05, “No discount”)1900

Double quotations “” are used to tell Excel to accept the text literally. Any text to be displayed in a cell should be enclosed with double quotations.

When testing a text string, the text will need to match perfectly. By using the SEARCH and ISNUMBER functions you can perform partial text matches and check if the Excel IF function contains text.

Primary Sidebar

Recent Posts

  • Excel SWITCH Function – Nested IF Function Alternative
  • Sum Formulas Only in Excel
  • How to Calculate Age in Excel
  • Custom Sort in Excel
  • Case Sensitive Lookup with XLOOKUP in Excel
Advanced Excel Success book

Footer

Contact

[email protected]

LinkedIn Twitter YouTube

Useful Links

  • Home
  • Excel Online Courses
  • Tutorials
  • Sitemap
  • Privacy Policy
  • Jobs by Jooble

Course Topics

  • Blog
  • Charts
  • Courses
  • Dashboards
  • Downloads
  • Excel Tips
  • Formulas
  • Mail Merge
  • Office
  • PivotTables
  • Power BI
  • Power Pivot
  • Power Query
  • VBA

Join Our Mailing List

© Copyright 2009 Computergaga · All Rights Reserved ·