VBA performance question

Asator

Board Regular
Joined
Apr 5, 2010
Messages
186
Which is faster in VBA with large data sets (~110k rows): using .Find, or loading the whole thing into an array in memory and doing a for-next loop to look for the data points I need?

I ask because using .find looks like it's going to take about 16 hours to process my data set (processing ~4200 part numbers through a recursive function to traverse their bills of materials).

Thoughts?
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Find is almost certainly faster than looping..

16 hours... Really??

Me thinks the slowness is caused by whatever action you're doing with each item found, not the method used to find each item.
 
Upvote 0
Hi,
would you like to present an example with Data and describe your algorithmization problem ? Best regards.
 
Upvote 0
Well, I'm also generating data on work center/cost center routings as well as material usage based on what I'm finding in the BOM and routings, so it's not like traversing is the ONLY thing happening here, but I just wanted to get an idea of which would be faster in principle.
 
Upvote 0
Well, I stand by my post then.
As a general principle / Best Practice..
Find is almost certainly faster than a for/next loop.
 
Upvote 0

Forum statistics

Threads
1,213,538
Messages
6,114,220
Members
448,554
Latest member
Gleisner2

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