VLOOKUP takes a column index number, such as 3 for the third column of the table, and that number is fixed text in the formula. When a column is inserted inside the table, the data shifts right but the index number stays the same, so the formula quietly returns the next column’s values instead of the intended ones. Check the index against the current table layout after any insert.
What you need
- The AI-written VLOOKUP formula
- The lookup table, with its current columns counted
- One known lookup value and the answer it should return
Step 1: Count the columns in the table now
Look at the table and count which column holds the answer the formula should return, counting from the table’s first column. Write that number down.
Step 2: Compare it with the index in the formula
Read the third argument of the VLOOKUP. If it differs from the number you counted, a column was inserted or deleted after the formula was written.
Step 3: Fix the index and test with two known values
Change the index to the counted number and test with two lookup values whose answers you know. Both must return the right column’s values.
Worked example: synthetic price list after a column insert
The table below is a synthetic example. It shows the expected result of checking an AI-written VLOOKUP; no formula was run.
| Check | Value | Result |
|---|---|---|
| Answer column counted now | 4 | Price moved right by one |
| Index in the formula | 3 | Written before the insert |
| Formula result | 18 | Stock count, not a price |
| Corrected index | 4 | Returns the price 42 |
Expected result (UNTESTED). the VLOOKUP with index 3 returns 18, a stock count, because a column was inserted and the price moved to column 4; changing the index to 4 returns 42, the known price. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- XLOOKUP uses a return range instead of an index number, so inserting a column does not break it.
- A column index larger than the table width returns #REF!, which is a different fault from a wrong column.
- Deleting a column shifts the data left and has the same effect in reverse.
- A VLOOKUP that points at a whole table, such as A:D, breaks when the table grows past column D.
