The IF statement is one of the most powerful and commonly used functions in Excel. It allows you to test a condition and return a value based on whether the condition is true or false. In this article, we will discuss five examples of using an IF statement in Excel, along with the data used and the result.

### Example 1: Testing for a Pass or Fail Grade

Suppose you have a list of students and their test scores, and you want to determine whether each student has passed or failed the test based on a passing score of 60.

To determine whether each student has passed or failed, you can use the following formula in column C:

=IF(B2>=60,”Pass”,”Fail”)

This formula checks whether the test score in column B is greater than or equal to 60. If the condition is true, the formula returns “Pass.” If the condition is false, the formula returns “Fail.” The result will be as follows:

### Example 2: Categorizing Age Groups

Suppose you have a list of people and their ages, and you want to categorize each person into one of three age groups: under 18, 18-64, or over 64.

To categorize each person into an age group, you can use the following formula in column C:

=IF(B2<18,”Under 18″,IF(B2<=64,”18-64″,”Over 64″))

This formula first checks whether the age in column B is less than 18. If the condition is true, the formula returns “Under 18.” If the condition is false, the formula checks whether the age is less than or equal to 64. If this condition is true, the formula returns “18-64.” If both conditions are false, the formula returns “Over 64.” The result will be as follows:

### Example 3: Calculating a Bonus

Suppose you have a list of employees and their sales, and you want to calculate a bonus for each employee based on their sales. If an employee’s sales are greater than or equal to \$10,000, they will receive a bonus of 5% of their sales. Otherwise, they will not receive a bonus.

To calculate a bonus for each employee, you can use the following formula in column C:

=IF(B2>=10000,B2*0.05,0)

This formula checks whether the sales in column B are greater than or equal to \$10,000. If the condition is true

, the formula multiplies the sales by 5% to calculate the bonus. If the condition is false, the formula returns 0. The result will be as follows:

### Example 4: Checking for Blanks

Suppose you have a list of data that includes some blank cells, and you want to check for these blank cells.

To check for blank cells, you can use the following formula in column B:

=IF(A2=””,”Blank”,”Not Blank”)

This formula checks whether the cell in column A is blank. If the condition is true, the formula returns “Blank.” If the condition is false, the formula returns “Not Blank.” The result will be as follows:

### Example 5: Creating a Progress Tracker

Suppose you are tracking the progress of a project that has multiple tasks. You want to create a progress tracker that shows the percentage of completed tasks.

To calculate the percentage of completed tasks, you can use the following formula in column C:

=IF(B2=”Completed”,1,IF(B2=”In Progress”,0.5,0))

This formula checks the status in column B and assigns a score based on the status. If the status is “Completed,” the formula returns a score of 1. If the status is “In Progress,” the formula returns a score of 0.5. If the status is anything else, the formula returns a score of 0. The result will be as follows:

To calculate the percentage of completed tasks, you can use the AVERAGE function to calculate the average of the scores. For example, you can use the following formula in cell D1:

=AVERAGE(C2:C6)

This formula calculates the average of the scores in column C, which gives the percentage of completed tasks. The result will be as follows:

This formula can be very useful when tracking the progress of a project or any other task that has multiple steps. By using the IF statement, you can easily assign scores based on the status of each step, and calculate the overall progress.