View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.misc
GKW in GA GKW in GA is offline
external usenet poster
 
Posts: 68
Default Problem with copy/paste VLOOKUP formula

RagDyer,
I am having trouble understanding the logic of your example
=VLOOKUP($A1,$G$1:$K$7,Rows($1:2),0) of how Rows($1:2) causes the column
indexing number to be incremented from 2 to 5. Would you mind explaining.

Here is a practical of something I am actually trying to do:
I have a workbook, BOOK1, that has one column, A. I also have BOOK2 that has
column A thru F. Column A is formatted the same in BOOK1 and BOOK2, in fact
BOOK2.A is a subset of BOOK1.A.

I would like to use VLOOKUP to populate cols B thru F of BOOK2 into BOOK1.xB
to BOOK1.xF in the rows for which BOOK1.xA = BOOK2.xA (x being the row
number)




"RagDyer" wrote:

All you have to do is include the *entire* datalist cell references in the
formula, and then just change the column index number when you enter the
formula in Column D.

For example, in C1:

=VLOOKUP($A1,$G$1:$I$7,2,0)

And, in D1:

=VLOOKUP($A1,$G$1:$I$7,3,0)

And copy down as needed.

Now, if you have a lot more columns to include in your lookup, you can use
another function within the Vlookup formula to *automatically* increment the
column index number as you copy the original formula across columns, along a
row.
And then copy down as needed.

For example, if you had Columns G to K in your datalist, enter in C1:

=VLOOKUP($A1,$G$1:$K$7,Rows($1:2),0)

And copy across to F1.

This would *automatically* increment the column index number, from 2 to 5.
Then copy down as needed.
--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------

"GKW in GA" wrote in message
...
If the table array is more than 2 columns, is it possible to paste more
than
one column into the target cols. Lets say the table-array instead of
G1:H7,
it's G1:I7. Is there a way to paste Hx:Ix into Cx:Dx if Ax is found in
G1:G7
(where x is the row number)

"Marcelo" wrote:

=VLOOKUP(A1,$G$1:$H$7,2,0)

hth
--
regards from Brazil
Thanks in advance for your feedback.
Marcelo



"GKW in GA" escreveu:

When I enter a VLOOKUP formula in a cell and then copy and paste it all
the
way down the remainder of the column, it not only changes the cell of
the
lookup value, it also changes the row/column of the table - array

Example:
If I enter =VLOOKUP(A1,G1:H7,2,0) in cell C1 and then copy and paste it
to
cell C2, it changes C2 to =VLOOKUP(A2,G2:H8,2,0).

What I really want is for C2 to contain the result of looking up A2 in
G1:H7
just like it does for C1. I don't want it to look in G2:H8.

Similarly, pasting the formula into C3 causes it to look in G3:H9 i/o
G1:H7.