how to convert vlooup to match?

ZionX

New Member
Joined
Mar 17, 2011
Messages
11
Good days, recently i wrote a loop function for vlookup, and is appear to work correctly, but it consume a lot of time, especially when processing huge amount of data, here is the code:
Code:
For cnt02 = r To IC02 + 1
    Range(Cells(p, 1), Cells(IR04, 1)) = Cells(p - 1, cnt02)
    For cnt03 = p To IR04
        Cells(cnt03, 1).Value = Cells(cnt03, 1) & Cells(cnt03, 2)
    Next cnt03
    Set rng01 = Range(Cells(p, cnt02), Cells(IR05 + p, cnt02))
    rng01 = Application.VLookup(Range(Cells(p, 1), Cells(IR05 + p, 1)), Worksheets("CBOM").Range("A:D"), 4, 0)
Next cnt02

and i know match function can perform same task as vloookup with save a lot of time, but after half of days keep on googling, i still din get hows the match work, can any one please help me up??? thank you so much.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Hi there,
just a match probably won't replace the Vlookup entirely... You'd want a combination of MATCH and OFFSET for that. First the match to find the right row and then the offset to get the right information.
What could also speed up your macro: make the range in your formula ("A:D") dynamically smaller (searching in e.g. A10:D50 is much faster).
Cheers,
Koen
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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