#1   Report Post  
Posted to microsoft.public.excel.misc
nc nc is offline
external usenet poster
 
Posts: 119
Default Vlookup Function

I am using the vlookup function.

How can I use the above function, so that I don't have to change the column
reference (col_index_num), when the relevant lookup column is moved within
the table (table_array)?


  #2   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Vlookup Function

Replace it with an index/match. The indexed col (return col) will auto-adjust
when you move it.

Example:
If you have in B2: =VLOOKUP(A2,Sheet2!A:D,3,0)
replace it with this equivalent index/match:
=INDEX(Sheet2!C:C,MATCH(A2,Sheet2!A:A,0))

When you move (cut n paste) Sheet2!C:C to say Sheet2!E:E
the formula will auto-adjust to stay in sync, viz.:
=INDEX(Sheet2!E:E,MATCH(A2,Sheet2!A:A,0))

while the vlookup stays unadjusted at:
=VLOOKUP(A2,Sheet2!A:D,3,0)
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:20,500 Files:365 Subscribers:65
xdemechanik
---
"nc" wrote:
I am using the vlookup function.

How can I use the above function, so that I don't have to change the column
reference (col_index_num), when the relevant lookup column is moved within
the table (table_array)?


  #3   Report Post  
Posted to microsoft.public.excel.misc
nc nc is offline
external usenet poster
 
Posts: 119
Default Vlookup Function

Thanks.

What about if I want the vlookup to pick the column based on the field name?



"Max" wrote:

Replace it with an index/match. The indexed col (return col) will auto-adjust
when you move it.

Example:
If you have in B2: =VLOOKUP(A2,Sheet2!A:D,3,0)
replace it with this equivalent index/match:
=INDEX(Sheet2!C:C,MATCH(A2,Sheet2!A:A,0))

When you move (cut n paste) Sheet2!C:C to say Sheet2!E:E
the formula will auto-adjust to stay in sync, viz.:
=INDEX(Sheet2!E:E,MATCH(A2,Sheet2!A:A,0))

while the vlookup stays unadjusted at:
=VLOOKUP(A2,Sheet2!A:D,3,0)
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:20,500 Files:365 Subscribers:65
xdemechanik
---
"nc" wrote:
I am using the vlookup function.

How can I use the above function, so that I don't have to change the column
reference (col_index_num), when the relevant lookup column is moved within
the table (table_array)?


  #4   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Vlookup Function

What about if I want the vlookup to pick the column based on the field name?
That's a new query. You could try using a MATCH expression to return the
col_index_num within the vlookup.
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:20,500 Files:365 Subscribers:65
xdemechanik
---

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
Embedded If Function in a Vlookup Function Excel Student Excel Worksheet Functions 2 January 13th 07 04:39 AM
Combine VLOOKUP and IF function so #NA isn't returned as a value from VLOOKUP buffgirl71 Excel Discussion (Misc queries) 12 November 14th 06 11:36 PM
HOW DO I NEST THE VLOOKUP FUNCTION WITH THE LEFT FUNCTION CHAIM Excel Worksheet Functions 1 July 27th 05 09:10 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
I want to use Vlookup function and AND function in a single formu. prakash Excel Worksheet Functions 3 January 25th 05 07:11 AM


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

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

About Us

"It's about Microsoft Excel"