Speed of Indirect or Index

wildcloud

Board Regular
Joined
Jun 22, 2009
Messages
55
I can use indirect or index to randomly retrieve data from a 10,000 long array,
Excel Workbook
C
60.094139914
70.136214049
Sheet1
Excel 2007
Cell Formulas
RangeFormula
C6=INDEX(Sheet4!A1:A10000,RANDBETWEEN(1,10000))
C7=INDIRECT("Sheet4!A"&RANDBETWEEN(1,10000))


which method will be more efficient? How can I do a benchmark?

Thanks.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I don't know how to get a benchmark on it, but I would think INDEX would be more efficient because INDEX is not a volatile function, while INDIRECT is.
 
Upvote 0
Echoing Hotpepper, INDIRECT may evaluate quicker than INDEX (which is I believe quite slow) but given it's Volatile it will invariably be processed far more frequently so long term INDEX would be preferred.

Mind you saying that you're using RANDBETWEEN so it's Volatile anyway...
 
Upvote 0
A few runs with FastExcel, averaged gives something like...

With INDEX...

Re Calc: 0.1
Full Calc 0.1
% Volatile: 46%
Microsecs/formula: 144

With INDIRECT...

Re Calc: 0.1
Full Calc 0.2
% Volatile: 44%
Microsecs/formula: 167

This kind of single-formula profiling might not be very useful. The assessment should probably be done like:

Time(Many Formulas)-Time(Many Formulas Except Target Formula)

in order to see how such a formula affects the system.
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,732
Members
448,987
Latest member
marion_davis

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