Any VBA tricks for Array Formula burdens?

Intermedius

New Member
Joined
Oct 12, 2012
Messages
32
Hello,

I have an array formula being inserted into an Excel Data table column via VBA statement, which then processes 100's & sometimes 1000's of lines that are taking too long for My laptop to process in a feasible amount of time.

I have chosen VBA because it appears moderately faster to clear the data and existing array formula, then add the new data 1st, rather than just keeping the array formula column filled, and use table properties to remove all other data and replace with new data.


Sub ClearTableData()

'Clear Table Data

With Sheets("Sheet1").ListObjects("Data_Table")
If Not .DataBodyRange Is Nothing Then
.DataBodyRange.Delete
End If
End With

I then append new data to the existing, but cleared data table.

After the new data is appended, i re-add the Array formula:

Sub AddArrayFormula()

'Add Array Formula


With ActiveSheet.ListObjects("Data_Table").ListColumns("ArrayColumn").DataBodyRange
.ClearContents
.Cells(1).FormulaArray = "=Array Formula"
End With

It could just be in my head that it works faster, as i have not timed the process and My data sets have changed overtime. In either case, the processing time is not ideal to achieve the result needed.
 
Last edited:

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
What's the array formula doing? Is it possible you could replace that with a Power Query routine?

Otherwise, the only other thing I see you could do it set ScreenUpdating to False, and Calculation to Manual, then turn them back on at the end.
 
Upvote 0
Suggest you explain the data set up & provide some sample inputs & results. Likely there are efficient alternative solutions. (Without array formulas.)

How long does calculation take with array formulas?
 
Upvote 0
What's the array formula doing? Is it possible you could replace that with a Power Query routine?

Otherwise, the only other thing I see you could do it set ScreenUpdating to False, and Calculation to Manual, then turn them back on at the end.

Suggest you explain the data set up & provide some sample inputs & results. Likely there are efficient alternative solutions. (Without array formulas.)

How long does calculation take with array formulas?

Hello Smitty and Fazza,

Depending on the volume of data, a data refresh can take 5-20 minutes.

The Array formula is an index/match checking each row in the data table and pulling in corresponding data from a column on another sheet in that workbook. {=IFERROR(INDEX(Calculation!A:A,MATCH($N8,IF(Calculation!B:B=[@Material],Calculation!A:A))),0)}

This thread has some background on the actual formula https://www.mrexcel.com/forum/excel-questions/1060309-two-way-lookup-exact-approximate-match.html

I have also found this resource regarding time of calculation methods similar to the one i am using.

https://exceloffthegrid.com/optimize-formula-calculation-speed-part-7-multi-criteria-lookups/
Lookup-formula-multi-criteria.png
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,047
Messages
6,122,858
Members
449,096
Latest member
Erald

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