IFERROR Excel Formula – What is it, syntax, examples and howto
IFERROR() were to be a person, I would hug her so hard that Jo (my wife) would get in to a cat fight with her. I know many a woman (and man) who get in to a fight with Excel formulas often. But thankfully, we avoid that as IFERROR is not a real person. It is, however a darned useful formula.
Since I cannot hug a formula anymore than I can get my son to sit tight, I will go ahead and sing an ode to her, in my style – by writing about how useful and powerful IFERROR formula is.
What is IFERROR() Formula & How does it work?
Introduced since Excel 2007, IFERROR() formula checks a formula (or expression) and returns the value of formula if there is no error, otherwise a custom formula.
=IFERROR(1/0,"Try splitting an atom instead!")
will give the message Try splitting an atom instead! because the expression 1/0 returns an error (DIV/0 error)
=IFERROR(0/1,"Try splitting an atom instead!")
will give the value 0 since 0 divided by 1 is 0.
How does IFERROR help me?
Archimedes once said, “Give me enough data and a spreadsheet, I can make any formula return an error.”
May be he was too confident, but errors are everywhere. And that is why IFERROR is useful. It provides an elegant and simple way to tackle the errors in your workbook.
Several common uses of IFERROR are,
- 1. While writing lookup formulas like VLOOKUP, INDEX+MATCH it is common to search for values that do not exist in your data. You can wrap such formulas in IFERROR for peace of mind.
- 2. While using reference formulas like INDEX, OFFSET, frequently, we try to fetch the data that is not in the list of values. This returns #REF errors. You can fix them with IFERROR easily.
- 3. While using arithmetic, numeric expressions, usually we end up dividing by 0. You can fix such things by using IFERROR.
=IFERROR(AVERAGE(...),"0")— Returns 0 when the list has zero values.
Things to keep in mind while IFERRORing:
Please note that IFERROR is oblivious to the type of error. That means, no matter what the error is (DIV/0, #NAME, #N/A, #REF… etc.), IFERROR treats all of them equally and shows the same value. In other words, IFERROR is like “Catch all” in programming world.
How to handle errors if you are using Excel 2003 or below?
In earlier versions of Excel, we have a formula called as ISERROR() that can check an expression or formula for error and return TRUE if so. This formula is not same as IFERROR, but we can use it along with IF() formula to get the same result. For eg.
works same as,
Notice that the ISERROR approach evaluates VLOOKUP formula twice!.
Do you IFERROR?
To err is human, to IFERROR is awesome.
Ever since discovering the IFERROR feature in Excel 2007, I have been using it so often. I use it to keep my output sheets clean and my formulas simple.
What about you? Do you use IFERROR? What is your experience like? Would you also give it a hug? If so, would your spouse get in to a cat fight with it? If so can you post some pics of it on our facebook page?
Please share your experiences and tips on using IFERROR() thru comments.
Do you want to be awesome in Excel?
Here is a smart way to become awesome in Excel. Just signup for my Excel newsletter. Every week you will receive an Excel tip, tutorial, template or example delivered to your inbox. What more, as a joining bonus, I am giving away a 25 page eBook containing 95 Excel tips & tricks. Please sign-up below:
Your email address is safe with us. Our policies
Leave a Reply
|Excel Challenge #1 – Make Nuts without Going Nuts||Convert ISERROR formulas to IFERROR formulas [macro]|