Search code examples
excelgoogle-sheetsarray-formulas

Google Sheets: Overwrite Error using ARRAYFORMULA + VLOOKUP


I'm using VLOOKUP with ARRAYFORMULA to add new data to rows in an existing workbook based on ID numbers. The data is coming from a separate tab. I can get this to work if the column that contains the field i'm importing is completely blank, but if there is existing data I get an overwrite error.

I want the formula to update if the cell is blank, ignore existing data, and display nothing if my "import" has no value and there is no existing value present either.

=(ARRAYFORMULA((IFERROR(IF(LEN(A2:A), VLOOKUP(A2:A, Sheet2!A2:B, 2, 0), )))))

Example: https://docs.google.com/spreadsheets/d/17k25gz0fi0BdJ06eqXIprIpHHF42jLe66PhGFHtzP_k/edit?usp=sharing


Solution

  • F2: =ARRAYFORMULA(IF(LEN(A2:A), IF(D2:D<>"", D2:D, E2:E), ))

    E2: =ARRAYFORMULA(IFERROR(IF(LEN(A2:A), VLOOKUP(A2:A, Sheet2!A2:B, 2, 0), )))

    enter image description here