Solved

vlookup excel 2007 to changes as formula is dragged across columns

Posted on 2014-01-15
13
351 Views
Last Modified: 2014-01-28
Hi Expert's

is it possible to write a vlookup formula...so as you drag the formula across from A2:Z2 the column reference changes to the next one along..

so =if(isna(vlookup(d3,d45:j55,3,0)),"",(vlookup(d3:j55,3,0)))
So the 3 changes. ..
0
Comment
Question by:route217
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
13 Comments
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39782112
That is the default behavior. Insert the formula in one cell, as you drag it vertically the column references will get updated.
0
 

Author Comment

by:route217
ID: 39782115
So...default. .meaning. ..no it cannot be done??

And firstly thanks for the feedback Macro Shadow
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39782119
No, it can be done and in fact it will be done automatically when you drag your formula vertically.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:route217
ID: 39782120
Sorry. ..I am looking for horizontal across. .
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39782121
Sorry that's what I meant.
0
 

Author Comment

by:route217
ID: 39782125
Apologies. ...the 3 changes to 4 the next column along...
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39782129
Isn't that what you want?
0
 

Author Comment

by:route217
ID: 39782136
Yes I do....I have just written the vlookup and dragged the formula across from d2 to f2 and column reference has stay fixed at 2.....
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39782162
Please upload a sample.
0
 

Author Comment

by:route217
ID: 39782167
Worked it out....use column(b1),false.  And drag
0
 
LVL 33

Accepted Solution

by:
Rob Henson earned 250 total points
ID: 39782190
When you have cell references within a formula they will change as you copy/drag across/down unless you append the row or column reference with $.

However, you are referring to the offset value in the lookup formula which is not a cell reference, it is just a number.

That offset number can be calculated in a number of ways.

COLUMN() - will give the column number of the column in which the formula resides, can be useful if the source data and the lookup based data have the sqame column layout. If the layout is basically the same but slightly different column poisitioning, you can use COLUMN()+n where n is the number of colummns different.

MATCH(value,range,type) - can be used to match a column header. The value would refer to the column header of the destination data, the range would be the row of headers in the source data, type would be 0 to find an exact match but that does mean that the column headers do have to match exactly.

To stop the default column changes, you can amend your formula to:

 =IF(ISNA(VLOOKUP($D3,$D$45:$J$55,3,0)),"",VLOOKUP($D3,$D$45:$J$55,3,0))

As you're using Excel 2007, it can be simplified further to:

=IFERROR(VLOOKUP($D3,$D$45:$J$55,3,0),"")

Thanks
Rob H
0
 
LVL 24

Assisted Solution

by:Steve
Steve earned 250 total points
ID: 39782237
OK, the question was about changing the lookup column from 3 to 4 to 5 etc not the lookup range.
The asker seems to have found the solution in the Column() function.

I would tend to use teh following (dropping the isNA):

=IFERROR(vlookup($d3,$d$45:$j$55,column(C1),0),"")
0
 

Author Comment

by:route217
ID: 39782321
Excellent. ...
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question