Solved

How to look info up on another spreadsheet file in Excel

Posted on 2011-03-24
10
209 Views
Last Modified: 2013-11-05
I need to do a price lookup from spreadsheet1 to spreadsheat2.  I need to do this via a macro because I have multiple look ups to do.  Can anyone help?


Spreadsheet1

Product A          $1.99
Product B          $2.09
Product C          $0.99

Spreadsheet2

ProductC
ProductA
ProductB
0
Comment
Question by:jrh70
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 6

Expert Comment

by:KnutsonBM
ID: 35206700
i know you said via macro, but a formula would work very well for this, vlookup is designed especially for this =vlookup(a1,'spreadsheet 1'!A:B,2,false) would do the trick

-brandon
0
 
LVL 6

Accepted Solution

by:
FernandoFernandes earned 250 total points
ID: 35206843
and if you have multiple lookups to do, you can put in the different columns, and change the third parameter, which is the column within the lookup range

=vlookup(a1,'spreadsheet 1'!A:C,3,false)
0
 

Author Comment

by:jrh70
ID: 35207723
is there a way to insert a variable while doing a vlookup?
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 6

Assisted Solution

by:KnutsonBM
KnutsonBM earned 250 total points
ID: 35207762
what kind of variable?  you can use an asterisk and it works well, here are a few examples,

=vlookup("*abcdefg*",'spreadsheet 1'!A:B,2,false)

this will look and see if that text is somewhere in the range

=vlookup("*"&A1&"*",'spreadsheet 1'!A:B,2,false)

this will look to see if text from a cell is somewhere in the range
0
 
LVL 6

Assisted Solution

by:KnutsonBM
KnutsonBM earned 250 total points
ID: 35207777
if you post an example of what you are working with it may make this easier to answer for you...

-brandon
0
 
LVL 6

Assisted Solution

by:FernandoFernandes
FernandoFernandes earned 250 total points
ID: 35207800
you can make dynamic vlookup() by using dynamic range (using ranged name), variable to determine which column you want to return, in this case the variable would be a reference to a cell,
even the range of the vlookup could be variable too, depending on selection in a cell, which could have list validation ...

you have to tell us exactly what you want and to make it quicker and easier, upload your file if possible !

:-)
0
 
LVL 32

Expert Comment

by:Rob Henson
ID: 35240615
I notice your lookup value on sheet 2 doesn't have the space in like that on the source document. Is that just a type error in your example or is that the case in the real file?

For the lookup to work properly the lookup values have to match.

Cheers
Rob H
0
 

Author Comment

by:jrh70
ID: 35240635
yes that was a typeo.  Sorry
0
 
LVL 6

Expert Comment

by:KnutsonBM
ID: 35240651
did any of these solutions work for you?  
0
 

Author Closing Comment

by:jrh70
ID: 35240654
I got it to work with modified code of the above.
Thanks
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel lookup tables & values 7 24
New Criteria Prototype 3 16
Unhide very hidden sheets with password 22 41
Excel error  #DIV/0! 7 18
INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

813 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now