how to change the numbers in a vlookup

bigdan

Well-known Member
Joined
Oct 5, 2009
Messages
768
I have a vlookup in col B, that looks at the 2nd column in the source data (ie Jan). That works fine.
But I'd like to drag this vlookup to the right so that it looks at the relevant columns. At the moment if I drag my vlookup to the right it'll keep looking at the 2nd column. I'd like the vlookup to automatically change the numbers so that when I drag it to the right, it'll look at the relevant column. Is there a way to fix that?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,332
Office Version
365
Platform
Windows
Something along the lines of
=VLOOKUP($L1,$A$2:$J$29,COLUMNS($A2:B2),0)
 

FracinDean

Board Regular
Joined
Jul 11, 2011
Messages
65
Use the COLUMN() function to retrieve a number equal to the column where the formula is. You can do addition or subtraction from that number.

For example, your vlookup formula is in column 4 and you are reading column 6 in your data table. Instead of entering "6" in the vlookup function, change it to "COLUMN()+2". When you use the fill handle or copy the formula to column 5, it will lookup the data from column 7 in your data table, etc.
 

Forum statistics

Threads
1,082,373
Messages
5,365,070
Members
400,821
Latest member
kezza123

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top