View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove[_2_] Harlan Grove[_2_] is offline
external usenet poster
 
Posts: 1,231
Default Vlookup for multiple results

Kris wrote...
....
For instance, I have a vendor listing in column A with a review date in
column B. *I want to search the vendor list and have the results return how
many times that vendor is found in the list and the date that corresponds
with the vendor.

Example
Vendor Name in column A
Office Depot
Staples
Office Max
Office Depot

Column B shows the date
02/11/05
03/5/03
04/15/06
12/14/07

I want to search the list for Office Depot for example and have it return
all the times it is listed in the column A and return the date that is in
column B for that vendor.

....

Simplest to select your 2-column list and apply and autofilter (menu
command Data Filter Autofilter). You may want to add a row above
the list with Vendor in col A and Date in col B of this new top row,
and include this new top row in your selected range when you apply the
autofilter.

The autofilter will add drop-down buttons to each column of the list.
You could use the col A drop-down button to select individual vendors
from the list.

If you have to use formulas, they're NOT simple formulas. I'll assume
you enter the vendor for which you want to extract records in cell F1.
If your list were in A2:B5 (you'll need to change this to correspond
to your actual list), you could use the following formulas.

F2:
=MATCH($F$1,$A$2:$A$5,0)

G2:
=IF(COUNT($F2),INDEX($A$2:$B$2,$F2,1),"")

H2:
=IF(COUNT($F2),INDEX($A$2:$B$2,$F2,2),"")

F3:
=IF(COUNT(F2),MATCH($F$1,INDEX($A$2:$A$5,F2+1):$A$ 5,0)+F2,"")

Fill G2:H2 down into G3:F3, then fill F3:H3 down as far as needed.