• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 217
  • Last Modified:

How to look info up on another spreadsheet file in Excel

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
jrh70
Asked:
jrh70
  • 4
  • 3
  • 2
  • +1
4 Solutions
 
KnutsonBMCommented:
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
 
FernandoFernandesCommented:
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
 
jrh70Author Commented:
is there a way to insert a variable while doing a vlookup?
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!

 
KnutsonBMCommented:
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
 
KnutsonBMCommented:
if you post an example of what you are working with it may make this easier to answer for you...

-brandon
0
 
FernandoFernandesCommented:
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
 
Rob HensonIT & Database AssistantCommented:
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
 
jrh70Author Commented:
yes that was a typeo.  Sorry
0
 
KnutsonBMCommented:
did any of these solutions work for you?  
0
 
jrh70Author Commented:
I got it to work with modified code of the above.
Thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now