Loop a Vlookup

AndyD

Active Member
Joined
Nov 14, 2002
Messages
449
Hi
i use the following type index in a spreadsheet and copy it down several thousand cells

=index(range_1,match(A2,range_2,0),2))

would it be more efficient if i did something like this in VBA? (if so, if someone could supply code would be great...

eg something along lines of

Cells(i,1)=vlookup formula (using "false", so always finds a match)
next i

etc, etc

any solutions (or ideas) welcomed...
cheers all
Andy
 

Some videos you may like

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

PaddyD

MrExcel MVP
Joined
May 1, 2002
Messages
14,234
"would it be more efficient if i did something like this in VBA? "

unlikely - built in functions invariably exute faster than anything you have to compile, among other reasons.

what, exactly, are you trying to do & what problems are you trying to overcome..
 

BrianB

Well-known Member
Joined
Feb 17, 2003
Messages
8,127
[built in functions invariably exute faster ]

I agree, but with a macro we can put something in the statusbar to show progress (eg. row number) when a long re-calc is required - which does show that Excel has not crashed. This is almost as good as the Cup of Coffee method (grin).
 

Watch MrExcel Video

Forum statistics

Threads
1,122,499
Messages
5,596,515
Members
414,074
Latest member
Matthew Kakde

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
Top