error and replace it with "Not found" or any other text you supply. As the result, you may never know your formula is delivering wrong results unless you spot the typo yourself. In such a case, a more reasonable approach would be trapping only #N/A errors. For this, useIFNA Vlookupfo...
IF(ISERROR(VLOOKUP(…)), "Not found", VLOOKUP(…)) Notice that in the IF ISERROR VLOOKUP formula, you have to Vlookup twice. In plain English, the formula can be read as follows: If Vlookup results in error, return "Not found", otherwise output the Vlookup result. And here is a rea...
ActiveCell.FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],R[-1]C[-5]:R[3]C[-4],2,0),""Error In Data"")"End Sub Now select the cell where we need to see the output in Range. Here we have selected cell F3. Code: SubVBA_IfError2() ActiveCell.FormulaR1C1 = "=IFERROR(VLOOKUP(R...