Google Sheets Function: IFERROR
The IFERROR function returns a value if it is not an error or another value in case of an error.
Usage:
=IFERROR(value, value_if_error)
Practical Case
The example used for the VLOOKUP function will be our starting point.
The VLOOKUP function here returns the number of points based on the file number entered in cell E2:
In this case, if the file number is not found, an error is returned:
To avoid displaying this error (without the IFERROR function), it would be necessary to use the IF function along with a second function to check if there is an error and then return the result of the VLOOKUP function or another value in case of an error:
=IF(ISNA(VLOOKUP(E2,A2:C11,3,0)),"-",VLOOKUP(E2,A2:C11,3,0))
In this case, the VLOOKUP function is present twice, and an additional function had to be added.
The IFERROR function simplifies the formula by testing the value returned by the VLOOKUP function and directly returning this same value if there is no error (or another value in case of an error):
=IFERROR(VLOOKUP(E2,A2:C11,3,0),"-")