15th April 2023

Iferror function


If I were asked to call the feature which I use more often than some other, I would probably have to say the IFERROR characteristic. This isn't always as it does anything especially effective or precise. In reality, the IF and ISERROR functions collectively can accomplish the whole thing the IFERROR characteristic can (explained on the cease). It's just much messier. The IFERROR function exists in simple terms for comfort, however convenience is a fantastic issue. Here's how it works:

Iferror function

There are 2 parameters inside the IFERROR function. The first parameter is what you want the cellular to include. The 2d parameter is what you need the cell to contain alternatively inside the event that the first parameter returns an mistakes. Here's an instance of ways this is probably used:

=IFERROR(A1/B1,0)

In the above instance, the function will take the price of mobile A1 and divide it via the cost of cell B1. However, if cellular B1 carries 0 or is blank then A1/B1 will bring about a #DIV/zero! Blunders. But, the usage of the IFERROR feature as in the instance above, the characteristic will alternatively go back zero.

Usually once I use this characteristic it's miles together with the VLOOKUP function. For instance:

=IFERROR(VLOOKUP(C1,A:B,2,FALSE),"")

This appears up the value of C1 in column A and returns the end result that's within the identical row of column B. However, if the cost of C1 isn't located in column A, the VLOOKUP function will return the #N/A error. But, because of the IFERROR function, the cellular may be clean alternatively (because of the empty quotes).

I actually have usually determined that clean cells looks plenty greater expert that having errors throughout your spreadsheet. In addition to being useful while the usage of the VLOOKUP function, this approach is also quite beneficial whilst the use of SEARCH, FIND, or truly every other function that has a knack for turning up mistakes.

Unfortunately, the IFERROR characteristic is simplest to be had for Excel 2007 and up. But, here's a way to work around it for people who are still using Excel 2003. In the previous example you will as an alternative use:

=IF(ISERROR(VLOOKUP(C1,A:B,2,FALSE)),"",VLOOKUP(C1,A:B,2,FALSE))

It's messier to examine due to the fact that you are required to enter your original characteristic two times, but it'll accomplish the precise identical component in the long run.