Link to home
Start Free TrialLog in
Avatar of Lennon Gary
Lennon GaryFlag for United States of America

asked on

vlookup and return multiple results (vba)

I need of a macro to perform VLOOKUP and return multiple results. there are two sheets (Sheet1 and Sheet2). the data I’m looking for in Sheet1 is in column C. the lookup value is in Sheet2, column A and want the results in column B but be horizontal.

example: for the lookup value in A1 I want the results to be in column B1 , C1 D1, E1 and etc.
test1.xlsx
Avatar of Rob Henson
Rob Henson
Flag of United Kingdom of Great Britain and Northern Ireland image

Some sample data would be good.

I am thinking you might be able to get a similar result with a pivot table rather than VBA

Create a pivot with column A header as a row value and column B header as column value, the result will be a matrix of column A values in rows and column B values in columns. If you filter on column A, the rows, for the lookup value, the only items to stay as column headers will be the matching values from column B.
If the lookup values are in column A on Sheet2, where these lookup values are found on Sheet1 i.e. in which column on Sheet1?

As Rob said, a sample workbook would be helpful.
Avatar of Lennon Gary

ASKER

i have uploaded a sample file. the lookup value is in Sheet2 Column A and i want the results to be in column B, C, D and etc.
ASKER CERTIFIED SOLUTION
Avatar of Rob Henson
Rob Henson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial