verying array formula to VBA

rickp2177

New Member
Joined
Aug 18, 2016
Messages
4
Hi All,

I have an array formula as below that works as intended, but is really slow to calculate values due to the size of the dataset. Therefore my though to speed this up is to convert it to VBA. I have searched, however am struggling to find any examples online.

Therefore any assistance would be appreciated.

{=INDEX(Sheet1!$A$1:$S$25466,MATCH(1,(Sheet1!$A:$A=B20)*(Sheet1!$D:$D=C20),0),E20)}

The formula is matching an article code with a colour code and then returns the qty from the size field.

B20 = Article Code
C20 = Colour Code
E20 = Size field

Sheet1

REF BRANCH STORES COLOUR 001 002 003 004
123456 BLK 5 4 0 3

Many Thanks
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
You'll see a 'significant' improvement of performance if you remove the Entire Column References A:A and D:D

=INDEX(Sheet1!$A$1:$S$25466,MATCH(1,(Sheet1!$A$1:$A$25466=B20)*(Sheet1!$D$1:$D$25466=C20),0),E20)
 
Last edited:
Upvote 0
And I'm not certain this will help performance, but you can make it not require CTRL + SHIFT + ENTER like this

=INDEX(Sheet1!$A$1:$S$25466,MATCH(1,INDEX((Sheet1!$A$1:$A$25466=B20)*(Sheet1!$D$1:$D$25466=C20),0),0),E20)
 
Upvote 0
Hi Thanks for the reply...

Have just tested and am seeing a 'big improvement'! in speed which is great, however it is still taking around 10 minutes to process. Any thoughts on how it could be improved further as I have large amounts of data to process?
 
Upvote 0
Will there be only 1 occurance of any given Article Code + Color Code ?
Which version of Excel are you using?
 
Upvote 0
Try this.

=SUMIFS(INDEX(Sheet1!$A$1:$S$25466,0,E20),Sheet1!$A$1:$A$25466,B20,Sheet1!$D$1:$D$25466,C20)
 
Upvote 0
Many Thanks Jonmo, have now completed my data conversion and your tips have saved me hours of processing time!

Could not get the SUMIFS statement to work due to the way the data was structured, but the reworking to remove the need for CTRL + SHIFT + ENTER has simplified things

Rick
 
Upvote 0

Forum statistics

Threads
1,216,108
Messages
6,128,872
Members
449,475
Latest member
Parik11

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