View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
smartin smartin is offline
external usenet poster
 
Posts: 915
Default List Box Columns

Bob Bridges wrote:

[snippens]

VLOOKUP(A30,'[Repository.xls]Grade 4'!$A$1:$X$23,COLUMN(),0)

Now the third argument is a 2 in column B, a 3 in column C and so on. That
formula you can copy throughout the whole range and it'll pull all the right
grades from the repository.

You can stop there and it'll work, but for future reference I'll warn you
that this technique, of using the column number to determine the column
reference in VLOOKUP, has a weakness: The next time you insert or delete a
column, anything to the right of it that depends on this technique will be
out of kilter, and you'll have to change every reference. Worse, it won't
necessarily be immediately obvious that it happened; after all, if your
column E shows the grade from column F, would you notice right away? I
maintain there must be a way around this weakness so I can get the best of
both, but I haven't sat down and figured it out yet.


One alternative is to place column identifiers in both worksheets, and
use INDEX/MATCH. This gets around using a relative column reference so
the formula will not break if a column is inserted somewhere.

It might look like this in cell Z30 (this is an array formula, complete
with Ctrl+Shift+Enter):

=INDEX('[Repository.xls]Grade 4'!$A$1:$X$23,
MATCH(1,--($A30='[Repository.xls]Grade 4'!$A$1:$A$23),0),
MATCH(1,--(Z$1='[Repository.xls]Grade 4'!$A$1:$X$1),0))

(line breaks entered for clarity)

This assumes row $1 has the column identifiers you want to coordinate.