If 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.
![]()
For eg:
=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)
Where as,
=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.
Ex:=IFERROR(VLOOKUP(...),"Not found") - 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.
Ex:=IFERROR(INDEX(...),"") - 3. While using arithmetic, numeric expressions, usually we end up dividing by 0. You can fix such things by using IFERROR.
Ex:=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.
=IF(ISERROR(VLOOKUP(...)),"Not found",VLOOKUP(...))
works same as, =IFERROR(VLOOKUP(...),"Not found")
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.
Related awesomeness:
1. How to understand and handle Excel formula errors
2. Excel formulas not working? What to do?
3. Handling errors and 5 other tips for writing better VLOOKUP formulas

















9 Responses to “Show forecast values in a different color with this simple trick [charting]”
While this works in a pinch, it clearly "lightens" the colors of the entire chart. Depending on where you use this, it will be blatantly obvious that you don't know what you are doing and present a poor looking graph.
Why not separate the data into different segments when charting and have as many colors as you have data points? You might have to create a new legend and/or repeat the chart in "invisible ink", but it would be cleaner and more consistent when new or updated data becomes available.
While I think I agree that doing it "properly" via a second series is preferable, I don't necessarily agree that making the entirety of the "future" (data, gridlines, and even the axis) semi-transparent is "poor looking". I think it could be seen as adding more emphasis to the "future-ness" of the forecast data.
In short, it's another tool for the toolbox, even if it's never needed.
Simply and clever 🙂
Quick & effective, cool. thanks.
I always use the dummy series.
Nice little trick, thanks very much!
Two sets of data better. Control is much better.
You can use the same chart next month to see what is actual and what is forecast.
To use this trick, I think grid lines has to be removed, that will make the graphic much more sharp.
to be honest, i dont understand why there is needed to do this way... in this case horizontal lines will be pale as well. then why a just can't change the color of the line partly???
Great tutorial. Thanks for the tutorial!