I have 3 tabs in excel
Tab A - "Pre"
Tab B - "Post"
Tab C - "Rec"
In Tab A & B I have the same column headers (15 dimensions and a value)
I create a unique lookup id (UID) based on a subset of the columns (and this can change run to run)
e.g. A|B|D|E|K
I move the UIDs from Tab A and Tab B to Tab C and filter this combined set of UIDs (and then sort) to get the unique UIDs from both tabs in Tab C.
I am then doing a sum if on both Tab A and Tab B and put the results in to Tab C in columns B & C (column B would be the Pre Sum and column C would be the Post Sum).
This gives the sums of the UIDs to allow me to check/compare the 'Pre' and 'Post' values to show the variances.
I have approx 56,000 lines in Pre and 85,000 lines in Post and 45,000 lines in UID tabs
Using Sumif, the runtime is about 7 minutes to do all these calculations.
It has been suggested I switch to using Arrays instead as it should be faster (thanks to the guys on Reddit r/VBA).
I have tried this (with my limited Array skills) and the runtime is still slower than when doing simple sumif's.
Can someone please advise what I am doing wrong with the array VBA code (shown below).
Thanks
Jon
Code for the Pre value sum is below.
Excel attached
It has the 3 tabs, with limited data in it
Tab Rec has examples of manual excel formula, VBA with SUMIF and VBA with Array,
When running across 50000 lines and 30000 UIDs it is slow in all 3 cases
Bookmarks