Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default How to write Vlookup to drag across a row?

How do you write a Vlookup function so that you can drag across a row and the
reference column will change automatically...so it goes from
=Vlookup(A1,A10:A20,2,false)
=Vlookup(A1,A10:A20,3,false) automatically?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 449
Default How to write Vlookup to drag across a row?

=Vlookup(A1,A10:A20,COLUMN(),false)
but it requires more calculation, so make sure your ease of dragging is
worth it.

HTH. Best wishes Harald


"J.Mart" wrote in message
...
How do you write a Vlookup function so that you can drag across a row and
the
reference column will change automatically...so it goes from
=Vlookup(A1,A10:A20,2,false)
=Vlookup(A1,A10:A20,3,false) automatically?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,856
Default How to write Vlookup to drag across a row?

You don't want the cell addresses to change, so you have to make these
absolute (at least the column part). Also, you want the 2 to change to
a 3, then to 4 etc, so here you can make use of the COLUMN function.
This will give you:

=Vlookup($A1,$A$10:$Z$20,COLUMN(B1),false)

Drag this across the row, and then down if you want to.

Note that I have changed your table reference to cover A to Z, which
means that you can copy this out to column Z if your table really is
that wide (but you just had a one-column table in your example, so
that wouldn't have worked).

Hope this helps.

Pete

On Dec 10, 10:21 pm, J.Mart wrote:
How do you write a Vlookup function so that you can drag across a row and the
reference column will change automatically...so it goes from
=Vlookup(A1,A10:A20,2,false)
=Vlookup(A1,A10:A20,3,false) automatically?


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default How to write Vlookup to drag across a row?

=Vlookup(A1,A10:A20,2,false)

Well, you have a problem in that your lookup table only refers to a single
column!

Try it like this:

Assuming you enter the formula in cell F1.

=VLOOKUP($A1,$A10:$D20,COLUMNS($F1:G1),0)

COLUMNS($F1:G1) evaluates to 2

As you copy across this will increment accordingly: 3, 4


--
Biff
Microsoft Excel MVP


"J.Mart" wrote in message
...
How do you write a Vlookup function so that you can drag across a row and
the
reference column will change automatically...so it goes from
=Vlookup(A1,A10:A20,2,false)
=Vlookup(A1,A10:A20,3,false) automatically?



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,572
Default How to write Vlookup to drag across a row?

You realize that your example formulas wouldn't work at all, since your
range is a single column.

Revising your range references, try this:

=VLOOKUP($A1,$A10:$K20,COLUMNS($A:B),0)

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"J.Mart" wrote in message
...
How do you write a Vlookup function so that you can drag across a row and
the
reference column will change automatically...so it goes from
=Vlookup(A1,A10:A20,2,false)
=Vlookup(A1,A10:A20,3,false) automatically?





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I write a basic VLOOKUP statement? Maureen New Users to Excel 7 September 25th 07 03:22 PM
Why do I get #NA as my result when I write a vlookup formula? trainer07 Excel Worksheet Functions 2 February 7th 07 01:13 AM
How do I write a VLOOKUP function that returns 0's, not neg vals? dbsavoy Excel Worksheet Functions 4 August 24th 06 05:26 PM
is it possible to execute write to the fields in another .xsl form a macro in another .xsl? e.g. some way to load another .xsl into an .xsl macro and write to its data? Daniel Excel Worksheet Functions 1 June 23rd 05 11:38 PM
how do I write a vlookup function within an iserror function so t. JBLeeds Excel Worksheet Functions 2 March 16th 05 10:30 AM


All times are GMT +1. The time now is 11:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"