+ Reply to Thread
Results 1 to 5 of 5

Convert Array Formula to Non-Array

  1. #1
    Registered User
    Join Date
    12-14-2018
    Location
    Staffordshire, England
    MS-Off Ver
    365
    Posts
    60

    Convert Array Formula to Non-Array

    Hi All,

    I have an array formula setup but the processing of this formula is slowing the calculations down on my file so was wandering if it can be converted to a non-array version to help speed things up a little? The file it is referring to currently contains 136,000 x 2 lines of data!

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Thanks,
    Gaz

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Convert Array Formula to Non-Array

    Don't use whole column references in MATCH for a start...

    try:

    =IF([@Shipper]=[@Consignee],
    INDEX([DataFile.xlsx]Partner!$B:$B,MATCH([@Consignee],[DataFile.xlsx]Partner!$A$2:$A$150000,0)),
    INDEX([DataFile.xlsx]Partner!$B:$B,MATCH(1,([@Shipper]=[DataFile.xlsx]Partner!$A$2:$A$150000)+([@Consignee]=[DataFile.xlsx]Partner!$A$2:$A$150000),0)))
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Convert Array Formula to Non-Array

    or maybe:

    =IF([@Shipper]=[@Consignee],
    INDEX([DataFile.xlsx]Partner!$B:$B,MATCH([@Consignee],[DataFile.xlsx]Partner!$A$2:$A$150000,0)),
    INDEX([DataFile.xlsx]Partner!$B:$B,INDEX(MATCH(1,([@Shipper]=[DataFile.xlsx]Partner!$A$2:$A$150000)+([@Consignee]=[DataFile.xlsx]Partner!$A$2:$A$150000),0),0)))


    non-array. Hard to check as no sample file was provided

  4. #4
    Registered User
    Join Date
    12-14-2018
    Location
    Staffordshire, England
    MS-Off Ver
    365
    Posts
    60

    Re: Convert Array Formula to Non-Array

    Hi, I have attached a quick test file with the array formula if you can take a look,

    Thanks,
    Gaz
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,432

    Re: Convert Array Formula to Non-Array

    I am not sure if merely changing to a non-array formula will make much difference in calculation time. I notice that you are using very slow linear "exact match" lookups. I would expect that the biggest gains in computation speed are going to be realized by changing those lookups to much more efficient binary "approximate match" lookups (where the 3rd argument of the MATCH() function is 1 or -1).

    The first step to making such a change is to look at the source database and sort the database by the lookup column. In your sample file (which is clearly mock data), the database in "Partner" is already sorted, but I cannot be sure that this is the case in your real database.

    Once the database is sorted, then you can edit the lookup functions to use the approximate match option. Exactly what that looks like depends on what adjustments were needed to account for the sorting of the database. For the first "value_if_true" argument in the existing formula, that might be as simple as replacing the 0 with a 1 in the MATCH() function. If there are other considerations then the changes will be more complex. For the second "value_if_false" argument in the existing formula, you will need to some major re-writing. Details depend largely on how sorting the database changes the necessary steps to the lookup.

    Because the details of the formula are going to depend on what needs to happen after the sorting step, I cannot offer any detailed suggestions. Because your example is clearly a mockup, I cannot see or understand how sorting the database changes the search step. If I had 100000+ rows to search through and computation time was important, I would go to some lengths to avoid linear "exact match" lookups in favor of much more efficient binary "approximate match" lookups. My suggestion is to look at your database and see what needs to happen in order to sort that list by original name.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 04-25-2017, 11:01 AM
  2. [SOLVED] Convert this array formula into VBA?
    By vpan in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 08-09-2016, 06:55 PM
  3. Convert array formula to VBA
    By nthnothing in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-06-2015, 10:23 PM
  4. Convert Boolean Array to an Integer Array
    By cmore in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 06-23-2014, 01:14 AM
  5. convert array formula to vba
    By s4driver in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-04-2013, 09:54 PM
  6. [SOLVED] Convert Date/Time array to a integer array
    By bradja in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-17-2013, 03:08 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1