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?
 

Some videos you may like

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
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.
 

hurgadion

Active Member
Joined
Mar 19, 2010
Messages
426
Hi,
would you like to present an example with Data and describe your algorithmization problem ? Best regards.
 

Asator

Board Regular
Joined
Apr 5, 2010
Messages
186
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.
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Well, I stand by my post then.
As a general principle / Best Practice..
Find is almost certainly faster than a for/next loop.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,499
Messages
5,596,517
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