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
VBAMicrosoft ExcelMicrosoft Office

Avatar of undefined
Last Comment
Rob Henson
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
Lennon Gary
Flag of United States of America image

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

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Microsoft Excel
Microsoft Excel

Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.

144K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo