Select all four cells and drag the fill handle at the bottom right-hand corner of the selection downward to row 12.
You should now have the numbers 1 through 12 in column A and the months Jan through Dec in column B.
In cell D1 enter the formula
=VLOOKUP(C1,A1:B12,2).
Now enter any number from 1 to 12 in cell C1. The formula will select the corresponding month name.
To demonstrate the problem, right-click on the heading of column B and choose Insert.
The formula changes to =VLOOKUP (D1,A1:C12,2), which returns 0.
Excel correctly changed the cell reference from C1 to D1 and expanded the lookup range to include the inserted column, but it cannot change the column index number.
Press Ctrl-Z to undo the column insertion.
The solution is to modify the formula so that the column index number is not hard-coded but instead is calculated from cell references.
You could use the COLUMN() function that returns the column number of the reference and, as in this example, compute the number of columns between the first and last columns:
=VLOOKUP (C1,A1:B12,COLUMN(B1)-COLUMN(A1)+1).
A more esthetically pleasing, or sophisticated, function might be:
COLUMNS(array)
This returns the number of columns in an array or reference.
The modified lookup function looks like this:
=VLOOKUP (C1,A1:B12,COLUMNS(A1:B1)).
Either way, now if a column is inserted in the middle of the range, the column index will be adjusted."