Tuesday, May 7, 2013

Using VLOOKUP in a Google Spreadsheet for adding new rows through form submission


In order to have a VLOOKUP formula apply to new rows added to a Google spreadsheet through form submission, add the following formula to a 2nd row column (below the header).

=arrayformula(vlookup(B2:B,Names!$A$1:$B$360,{2}*sign(row(B2:B)),FALSE))

The first argument of vlookup is the range of cells for your lookup values.
The second argument is your table array. This example uses a 2-column table array.
The third argument is the column index number. The use of the formula 'sign' is key to make an array that is the same length as the first argument.
The fourth argument is a boolean value that specifies whether you want vlookup to find an exact match or an approximate match.