Combination of IFERROR and VLOOKUP formula in Excel
=IFERROR(VLOOKUP(H2,A:B,2,0),VLOOKUP(H2,D:E,2,0))
The formula we've used is an IFERROR
function combined with two VLOOKUP
functions.
Here's a breakdown:
VLOOKUP(H2, A:B, 2, 0)
: This part of the formula attempts to find the value in cell H2 in the range A:B. If found, it returns the corresponding value from the second column (column B).
VLOOKUP(H2, D:E, 2, 0)
: If the first VLOOKUP
fails (returns an error), the second VLOOKUP
is attempted. This part looks for the value in H2 in the range D:E and returns the corresponding value from the second column (column E).
IFERROR(..., ...)
: The IFERROR
function checks if the result of the first VLOOKUP
is an error. If it is, it uses the result of the second VLOOKUP
. If the first VLOOKUP
is successful, it uses its result.
Benefits and Description:
Error Handling: The primary benefit of this formula is error handling. If the first VLOOKUP
encounters an error (e.g., if the value is not found), the second VLOOKUP
is used as a backup, preventing the formula from breaking.
Data Lookup: It's useful for looking up values in two different ranges and providing a fallback in case the first range doesn't contain the lookup value.
Flexibility: This formula is flexible and can be extended to handle more lookup ranges or customized to suit specific requirements.
Readability: By using IFERROR
, you make your formula more readable and robust. It clearly communicates the intention to handle errors gracefully.
Video link: https://youtu.be/zj9i830VSYE
0 Comments