EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Certification Courses
  • 120+ Courses All in One Bundle
  • Login

Excel IF Function

Home » Excel » Blog » Logical Functions in Excel » Excel IF Function

IF Function in Excel

Excel IF Function (Table of Contents)

  • IF Function in Excel
  • How to Use IF Function in Excel?

IF Function in Excel

The IF Function is the most popular function in Excel and it allows to make logical comparisons between a value and what you expect the output. We all know Excel is used for different types of reports. Some reports may contain huge data with lots of field in it. But it can happen that the report may not give you the desired result which is based on certain fields in the report. This is where Conditional formulas are used. If you need an outcome based on the criteria which depends on a field available in the report, you can use conditional formulas of excel.

Start Your Free Excel Course

Excel functions, formula, charts, formatting creating excel dashboard & others

There are many conditional formulas available in Excel. e.g. IF, OR, AND etc. but we will cover IF Function here.

The IF Function is an inbuilt function in Excel which is categorized as a Logical Function.

How to Use IF Function in Excel?

IF Function can be used as a worksheet function in Excel which means it can be entered as a part of a formula in a cell of the Worksheet. IF Function gives the outcome based on the conditional criteria for a field.

The Syntax for the IF Function in Excel is:

IF (Condition, Value_ if_ true, [ Value _ if _false])

IF Function syntax

Example #1

Let’s understand How to use the IF Function in Excel using some examples.

Popular Course in this category
Excel Advanced Training (14 Courses, 23+ Projects)14 Online Courses | 23 Hands-on Projects | 133+ Hours | Verifiable Certificate of Completion | Lifetime Access
4.8 (6,606 ratings)
Course Price

View Course

Related Courses
Excel Data Analysis Training (12 Courses, 8+ Projects)Excel for Marketing Training (5 Courses, 13+ Projects)
You can download this IF Function Excel Template here – IF Function Excel Template

Below is the data with Sales Target and Actual Sales of the respective employees.

If Function in Excel Example 1 Excel Data

There are 5 people in your team in Column A and you have given them the sales target for a month in Column B and their actual sales done is given in Column C, so with the given data you need to evaluate which person has achieved the target and who has not achieved the Target in Column D.

Now we will input the formula for Employee Shikha in Column D2- =IF(C2>=B2,”Target met “,”Target not Met”).

Let’s break the formula in three parts to get a better understanding.

  • Condition
  • Value IF TRUE
  • Value IF FALSE

Now in our example,

Condition – C2>=B2

Value IF True – Target Met

Value IF False – Target Not Met

IF Function Example 1-2

By dragging the C2 cell till C6 cell, we will get the result for all employees.

IF Function Example 1-3

So, you can see that based on the data in Column B and C, we got to know which employee has MET TARGET and which has NOT MET TARGET.

Nested IF Statements

The IF Function can be “Nested” which refers to a formula where at least one IF Function is nested inside another to test for more than one condition which in return give more possible results. So, in “nested IF Statements” you must be very careful because each IF Statement needs to be nested inside another, so the logic is correct. You can refer the below example which will show you the usage of the “Nested IF” Formula.

Example #2

In this example, we have 5 students and their respective marks in 5 subjects which will give us the Total marks for each student and their % of Marks.

 Example 2 Excel Data

Now to know the grades of each student we will use the IF Function by using their % marks. We want to give the students 3 Grades-A, B & C.

We will use Formula in I2 Column- =IF(H2>=80,” A”, IF(H2>=70,” B”, IF(H2>=60, “C”))).

Nested If Function Example 2-2

 Example 2 Final Result

You can input the IF Formula in I2 Column and can autofill till I6. So, this is how we got the grades of the students by using the IF Function.

Example #3

We have the data of some comedians who came for shopping so here in below example, we will show you that IF their total bill is more than 5000 they will get 10% Discount. Let’s go through the example which will give a clear understanding of the use of the IF function and Nested IF.

Example 3 Excel Data

Now in our example, we will first show the use of the IF Function and then the Nested IF function.

Condition- C2>=5000

Value IF True – 10%

Value IF False – 0

Now we will input the IF Function Formula in E2 column, Syntax- =IF(C2>5000,”10%”,”0″). It will show who will get 10% Discount and who will not.

Example 3-2

You can autofill the rest of the E column till we have data.

 Example 3-3

Now we will show you how can we use the Nested If Statement for the same example. In the Nested IF formula, at least one IF Function is nested inside another to test for more than one condition.

Here the Conditions are

  1. Customer Bill>20000, “A”
  2. Customer Bill>10000, “B”
  3. Customer Bill <10000, “C”

Formula for Nested IF in our example is as follows

=IF(C2>20000,”A”, IF(C2>10000,”B”,”C”)).

Example 3-4

By dragging the cell F2 till cell F9, we will get the result for all the customers.

 Example 3 Final Result

In the above Example, the customer’s bill> 20000 will be category A, the customer’s bill>10000, it will be category B and the customer’s bill<10000, it will be category C.

Example #4

In this example, an Employee has made the budget of the expenses for his Onshore Trip. In the below screenshot, there is his budgeted data and the Actual amount spent by him.

Now in our example,

Example 4 Excel data

Condition- C2>=B2

Value IF True- Over Budget

Value IF False – In Budget

Now we will input the IF Function Formula in D2 Column to know whether his expenses are in his Budget or Overbudget.

Formula will be- =IF(C2>=B2,”Over Budget “,”In Budget”).

IF Function Example 4-1

 Example 4 Final Result

Things to Remember About IF Function in Excel

  1. IF Function is used to test or evaluate certain conditions and then give results differently depending on that condition.
  2. Up to 64 IF Functions can be Nested when you are using the Nested Formula.
  3. If any arguments to the IF are supplied as an array, the IF function will evaluate every element of that array.
  4. When you are applying the IF Formula and using text values in the formula, you need to enclose the text in double quotes (e.g. “Text”).
  5. The IF Function can be combined with Logical functions like AND & OR.

Recommended Articles

This has been a guide to IF Function in Excel. Here we discussed How to Use the IF Function in Excel along with practical examples and a downloadable excel template. You can also go through our other suggested articles –

  1. COUNTIF Excel Function
  2. Nested IF Formula in Excel
  3. VBA IF Statements
  4. SUMIF Formula in Excel

All in One Excel VBA Bundle (120+ Courses, 30+ Projects)

120+ Online Courses

30+ Projects

500+ Hours

Verifiable Certificates

Lifetime Access

Learn More

7 Shares
Share
Tweet
Share
Primary Sidebar
Excel Functions
  • Logical Functions in Excel
    • Excel IF AND Function
    • SUMIF with Multiple Criteria
    • Excel SUMIFS with Dates
    • FALSE Function in Excel
    • Excel IF Function
    • Excel Logical Test
    • Excel XOR Function
    • Logical Functions Excel
    • IFERROR Excel Function
    • TRUE Function in Excel
    • OR Function in Excel
    • NOT in Excel
    • AND Function in Excel
  • Excel Functions (12+)
  • Excel Tools (110+)
  • Financial Functions in Excel (17+)
  • Lookup Reference Functions in Excel (33+)
  • Maths Function in Excel (46+)
  • TEXT and String Functions in Excel (25+)
  • Date and Time Function in Excel (22+)
  • Statistical Functions in Excel (58+)
  • Information Functions in Excel (4+)
  • Excel Charts (55+)
  • Excel Tips (220+)
  • Workplace Productivity (4+)
  • Microsoft Office Tools (15+)
  • Excel Formula and Functions (20+)
  • MS Excel Shortcuts (4+)
Excel Functions Courses
  • Online EXCEL ADVANCED COURSE
  • Excel Data Analysis Certification
  • Excel for Marketing Certification
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Excel Charts
  • Excel Tips
  • All Tutorials
Certification Courses
  • All Courses
  • Excel VBA Course - All in One Bundle
  • VBA Course
  • Excel Data Analysis Course
  • Excel for Marketing Course
  • Excel for Finance Course
  • Excel for HR Training

© 2020 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Excel Course

Excel functions, formula, charts, formatting creating excel dashboard & others

*Please provide your correct email id. Login details for this Free course will be emailed to you
Book Your One Instructor : One Learner Free Class

Let’s Get Started

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

EDUCBA

Download IF Function Excel Template

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

EDUCBA
Free Excel Course

Excel functions, formula, charts, formatting creating excel dashboard & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

Special Offer - Online EXCEL ADVANCED COURSE Learn More