View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Arvi Laanemets Arvi Laanemets is offline
external usenet poster
 
Posts: 510
Default use vlookup with offset function

Hi

It looks like your sourse table will be grouped by items. When this is the
case, then let's assume your source table is on sheet Sheet1, with headers
in row 1, and that the output table will be on some another sheet, with
headers (for name and figure columns) there in row 3 and data validation
list dropdown in cell A1.

1. Define the cell A1 on output sheet sa a named range (Selection in my
example here);
2. For sheet Sheet1 define a dynamic named range (Item as an example)
Item=OFFSET(Sheet1!$A$1,1,,COUNTA(Sheet1!$A:$A)-1,1);
3. Define named ranges
SelectRow1=MATCH(Selection,Item,0)
SelectCnt=COUNTIF(Item,Selection)
SelectRng=OFFSET(Sheet1!$A$1,SelectRow1,,SelectCnt ,5);
4. On output sheet, into call A4 enter the formula
=IF(ISERROR(INDEX(SelectRng,ROW()-ROW(A$3),COLUMN()+1)),"",INDEX(SelectRng,ROW()-ROW(A$3),COLUMN()+1))
, and copy it into range A4:D4;
5. Copy the range A4:D4 down for as much rows as you estimate you'll need to
display all rows for any item.

It's done! Select an item in cell A1 on output sheet, and according rows are
displayed. Don't forget - whenever you add data into source sheet, sort the
table by items before processing the report.


--
Arvi Laanemets
( My real mail address: arvi.laanemets<attarkon.ee )


"liem" wrote in message
...
I have a drop down menu when I selected a item (merchandise...) I want to
return three row and four columns (B to e)
drop down menu merchandise
Gasoline
Food
A B c d e
merchandise john robert 500 40 4 .2%
merchandise jeff gordon 800 90 4.5%
merchandise julia robel 1000 90 6.5%
gasoline mak dune 50 34 3,2%
gasoline nancy thom 90 37 8.1%
gasoline john good 200 34 5.4%
food john 19 11 4.4%

what is the formula when I used vlookup(merchandise ...)
--
thanks