Avatar of Lennon Gary
Lennon Gary
Flag 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
VBAMicrosoft ExcelMicrosoft Office

Avatar of undefined
Last Comment
Rob Henson

8/22/2022 - Mon
Rob Henson

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.
Subodh Tiwari (Neeraj)

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.
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.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ASKER CERTIFIED SOLUTION
Rob Henson

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question