MrExcel Message Board


Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Mar 30th, 2004, 04:24 PM   #1
Bidwin
 
Join Date: Apr 2002
Posts: 27
Default Lookup and retrieve multiple cells

Is it possible to retrieve multiple cells from a table with one lookup function? For example, I have a table that contains product information. Column A contains a product code, and Columns B thru E contain pricing information. How can I search for a product code then return the related four columns with one function?
Thanks,
Bidwin
Bidwin is offline   Reply With Quote
Old Mar 30th, 2004, 04:27 PM   #2
texasalynn
 
texasalynn's Avatar
 
Join Date: May 2002
Location: Houston, TX
Posts: 5,426
Default Re: Lookup and retrieve multiple cells

Vlookup will return the data based on the product code. You would put the vlookup with the change on the column being returned in each formula,

vlookup(a1,tablelookup,2,0)
vlookup(a1,tablelookup,3,0)
vlookup(a1,tablelookup,4,0)

HTH
texasalynn
texasalynn is offline   Reply With Quote
Old Mar 30th, 2004, 04:37 PM   #3
onlyadrafter
 
Join Date: Aug 2003
Location: England
Posts: 4,584
Default Re: Lookup and retrieve multiple cells

Hello,

Do you mean you want all these cells in one cell after the VLOOKUP, if so then you just need to combine texasalynns formula i.e.

=vlookup(a1,tablelookup,2,0)&" "&vlookup(a1,tablelookup,3,0)&" "&vlookup(a1,tablelookup,4,0)&" "&vlookup(a1,tablelookup,5,0)


the " " just puts a space between the data.
__________________
-------------------------
Hope this is helpful.
-------------------------
only a drafter,
but broadening my Excel knowledge.
onlyadrafter is offline   Reply With Quote
Old Mar 30th, 2004, 05:10 PM   #4
Bidwin
 
Join Date: Apr 2002
Posts: 27
Default Re: Lookup and retrieve multiple cells

Thanks for your replies, Lynn and Drafter. I should have made my question clearer: I want to look up a product code in Column A of a table, retrieve related cells in Columns B thru E, and place the retrieved cells into separate cells, not combine them. My first solution was the same as Lynn's.
Thanks again,
Bidwin
Bidwin is offline   Reply With Quote
Old Mar 30th, 2004, 05:49 PM   #5
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 39,332
Default Re: Lookup and retrieve multiple cells

Quote:
Originally Posted by Bidwin
Thanks for your replies, Lynn and Drafter. I should have made my question clearer: I want to look up a product code in Column A of a table, retrieve related cells in Columns B thru E, and place the retrieved cells into separate cells, not combine them. My first solution was the same as Lynn's.
Thanks again,
Bidwin
Actually, what Alynn proposed provides solves your retrieval problem. What follows would be more efficient...

******** ******************** ************************************************************************>
Microsoft Excel - Book9___Running: xl2000 : OS = Windows Windows 2000
(F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)bout
=

A
B
C
D
E
F
G
H
I
J
K
L
1
*Position2345*Table*Products*&*Prices
2
p112.32.21.91.87*ProductXYZW
3
p7#N/A*
*
*
*
*p12.32.21.91.87
4
*******p23.13.72.983.2
5
************
Sheet1*

[HtmlMaker 2.32] To see the formula in the cells just click on the cells hyperlink or click the Name box
PLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR.


Name your lookup table, which can be anywhere outside the retrieval area, PriceTable. In the above exhibit, PriceTable refers to: H3:L4.

Formulas...

A1:A2 houses lookup values of interest.

C1:F1 houses column index values that refer to columns within PriceTable from which you want to retrieve appropriate prices.

B2:

=MATCH(A2,$H$3:$H$4,0)

C2, which is copied across...

=IF(ISNA($B2),"",INDEX(PriceTable,$B2,C$1))

Finally, select B2:F2 and copy down.
Aladin Akyurek is offline   Reply With Quote
Old Mar 30th, 2004, 07:57 PM   #6
Bidwin
 
Join Date: Apr 2002
Posts: 27
Default Re: Lookup and retrieve multiple cells

Thanks for the neat solution, Aladin.
Bidwin
Bidwin is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT +1. The time now is 06:24 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
All contents Copyright 1998-2009 by MrExcel Consulting.