VBA alternate to VLOOKUP

22strider

Active Member
Joined
Jun 11, 2007
Messages
311
Hello Friends

Is there a VBA alternate way of doing what VLOOKUP does in worksheet?

For my project I have to search and grab information from other spreadsheet(s). With size of the data it is taking unacceptably long time to get the information.

If there is a way to perform this action using VBA then my assumption is that it would be faster than VLOOKUP.

Thanks
Rajesh
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Is there a VBA alternate way of doing what VLOOKUP does in worksheet?

For my project I have to search and grab information from other spreadsheet(s). With size of the data it is taking unacceptably long time to get the information.

If there is a way to perform this action using VBA then my assumption is that it would be faster than VLOOKUP.
The WorksheetFunction offers a VLOOKUP method that can be used, although it might be faster to just use the Find method of a Range (I think it could also be done using Evaluate also)... hard to tell you more since you gave us no information about your set up, what you are trying to find, where you want to find it at nor where or how the return value should come from or be used.
 
Upvote 0
Hello Rick

Thanks for your message. I am posting sample data tables and sample result table. I need to create result table by taking inputs from source1 and source2.
Column 'Tool' is common between Source1 and source2. Following are the tables:


Excel 2007
ABCDE
2Source1
3Manufacturer Part NumberManufacturer NameLifecycle PhaseTool1Tool2
410164MODERNUnassignedFair
5512504ABC INCUnassignedExcellent
6512505OPTEX INCUnassignedExcellent
7B0001CORPORATIONUnassignedExcellent
8B0002CORPORATIONUnassignedExcellent
9B0003CORPORATIONUnassignedExcellent
10B0004CORPORATIONUnassignedExcellent
11B0005CORPORATIONUnassignedExcellent
12B0011HONG KONGApprovedExcellent
Source1



Excel 2007
ABCD
2Source2
3Part NumberDescriptionManufacturers.MPN TypeTool
4ABCDRandom descriptionTool10164
5EFGHRandom descriptionTool512504
6XYZRandom descriptionTool512505
7LMNRandom descriptionToolB0001
8QRSRandom descriptionToolB0002
9GHRRandom descriptionToolB0003
10KHVRandom descriptionToolB0004
11XHDGRandom descriptionToolB0005
12BIFKRandom descriptionToolB0011
Source2



Excel 2007
ABCDE
2Result
3Part Number(From Source2)Tool (From Source2)Manufacturer Name (From Source1)Tool1 (From Source1)Tool2 (From Source1)
4ABCD10164MODERNFair
5EFGH512504ABC INCExcellent
6XYZ512505OPTEX INCExcellent
7LMNB0001CORPORATIONExcellent
8QRSB0002CORPORATIONExcellent
9GHRB0003CORPORATIONExcellent
10KHVB0004CORPORATIONExcellent
11XHDGB0005CORPORATIONExcellent
12BIFKB0011HONG KONGExcellent
13
Result


Thanks for your help
Rajesh
 
Upvote 0
Could someone please review my request?
Assuming the worksheet names for your source data are Source1 and Source2 (and that your data starts on Row 4, headers on Row 3, as you have shown), put these formulas in the indicated cells on your Result sheet and then copy them down...

A4: =IF(Source2!A4="","",Source2!A4)

B4: =IF(Source2!D4="","",Source2!D4)

C4: =IF(B4="","",VLOOKUP(B4,Source1!A4:B12,2,FALSE))

D4: =IF(B4="","",VLOOKUP(B4,Source1!A4:D12,4,FALSE))

E4: =IF(B4="","",VLOOKUP(B4,Source1!A4:E12,5,FALSE))
 
Upvote 0
Hello Rick

Thanks for your message; but I am trying not having to use VLOOKUP. I need to do this by using VBA.

The sample data shown is very small but actual data is large with potential of getting even larger. Currently there are about 4500 rows and about 10 columns that need to be created by reading both the source data spreadsheets. I have set up VLOOKUP but it takes a long time to run.

I was trying to do this by VBA assuming it would be faster than VLOOKUP.

Thanks
Rajesh
 
Upvote 0

Forum statistics

Threads
1,215,024
Messages
6,122,729
Members
449,093
Latest member
Mnur

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top