If you have to divide figures in one column by figures in another column, you may not want the error message #DIV/0 to appear if one of the figures in a second column is a zero. Or, if you are using VLOOKUP, you may not want #N/A to appear if what you are looking up does not appear in your data table.
I will demonstrate first of all with a division, then with a VLOOKUP.
Select the cell for the first of your division calculations.
Type in an equals sign as all formulae and functions start with an equals sign.
Now type IFERROR followed by an opening bracket (; now type in the formula to be checked, then type a comma, then your required result if there would be an error, followed by a closing bracket. Then click the tick to the left of the formula bar or press the Enter key.
So, we might have =IFERROR(b2/c2,””), which will return a blank if the formula result would give an error message; or =IFERROR(b2/c2,”Check data”), which will return the text Check data if the formula result would give an error message.
The formula can then be replicated down the column using the fill handle in the usual way.
In a VLOOKUP, if what is being looked up is not present in the larger dataset you will get the error message #N/A. If we want to set up a VLOOKUP to include the possibility of many rows no matter how many individual items there are, we might reproduce our VLOOKUP function down several rows to begin with, then if there are less individual items to look up than number of rows, it may look slightly messy. In the example shown here, I have set up my worksheet to allow for the possibility about being asked about 10 wine codes, but I might be asked for rather less than this.
In this case the IFERROR function can also be used, as shown below.