How to Use IF and IFERROR Combined in Excel (3 Examples)

Example 1 – Calculate the Sales Bonus

We have two columns containing Sales Target and Sales Achieved for some products. We’ll check in Column E if the achieved sales have met the sales target and return a statement.

Dataset to Use IF and IFERROR Combined in Excel

Steps:

  • Insert the following formula in cell E5.

=IFERROR(IF(D5>=C5,$C$15*(D5-C5)/C5,"Not Applicable"),"Sales Target is not Correctly inserted")

  • Press Enter.

calculate sales bonus to Use IF and IFERROR Combined in Excel

  • Drag the Fill Handle icon to fill the other cells with the formulas.

How Does the Formula Work?

IF(D5>=C5,$C$15*(D5-C5)/C5,”Not Applicable”) checks whether the value of cell D5 is greater or equal to that of C5. If it is greater, then it returns the value of cell $C$15*(D5-C5)/C5  else it will return the “Not Applicable” text.

The IFERROR function checks the first argument, whether it holds any errors or not. If it does, then the IFERROR function returns “Sales Target is not Correctly inserted” text. If not, it returns the value of the cell.


Example 2 – Determine Achieved Sales Through IF and IFERROR

We’ll hardcode sales thresholds and return a percentage of the sales as income.

 Use IF and IFERROR Combined in Excel

Steps:

  • Use the following formula in cell D5.

=IFERROR(IF(C5<32500,C5*16%,IF(C5<73500,C5*26%,C5*29%)),0)

  • Press Enter.

determine achieved sales to Use IF and IFERROR Combined in Excel

  • Drag the Fill Handle icon to fill the other cells with the formulas.

How Does the Formula Work?

IF(C5<32500,C5*16%,…) checks whether the value of cell C5 is smaller that of 32500. If it is smaller, then it returns the value of C5*16%  else it moves on to the next portion of the formula

IF(C5<73500,C5*26%,C5*29%) checks whether the value of cell C5 is smaller that of 73500. If it is smaller, then it returns the value of C5*26%  else it returns the value of C5*29%.

The IFERROR function checks the first argument, whether it holds any errors or not. If it does, then the IFERROR function returns 0. If not, it returns the value of the cell.

Read More: How to Use Conditional Formatting with IFERROR in Excel


Example 3 – Track Project Progress

We have a list of projects and want to track progress for each person.

track project progress to Use IF and IFERROR Combined in Excel

Steps:

  • Click the Developer tab on your ribbon.
  • Select Visual Basic from the Code group.

  • Go to the Insert tab on the VBA editor.
  • Click on Module from the drop-down.

insert module to Use IF and IFERROR Combined in Excel

  • A new module will be created.
  • Select the module if it isn’t already selected.
  • Insert the following code in it.
Sub track()
Range("E5").Select
    ActiveCell.FormulaR1C1 = _
        "=IFERROR(IF(RC[-1]>=RC[-2],(RC[-1]-RC[-2])/RC[-2],""Completed""),""Incorrect values"")"
    Range("E5").Select
    Selection.AutoFill Destination:=Range("E5:E12")
    Range("E5:E12").Select
End Sub
  • Save the code.
  • Close the Visual Basic window.
  • Press Alt + F8.
  • Select the following macro in Macro name.
  • Click on Run.

  • This will track the project’s progress as shown below.

 Use IF and IFERROR Combined in Excel

Read More: How to SUM with IFERROR in Excel


Download the Practice Workbook


Related Articles


<< Go Back to Excel IFERROR Function | Excel Functions | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Saquib Ahmad Shuvo
Saquib Ahmad Shuvo

Saquib Ahmad Bhuiyan, holding a BSc degree in Naval Architecture & Marine Engineering from Bangladesh University of Engineering and Technology, skillfully integrates engineering expertise with a passion for Excel. He provides solutions to complex issues as an Excel & VBA Content Developer for ExcelDemy Forum. He demonstrates an enthusiastic mindset and adeptness in managing critical situations with finesse, showcasing his commitment to excellence. Apart from creating Excel tutorials, he is interested in Data Analysis with MS Excel, Rhinoceros,... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo