+ Reply to Thread
Results 1 to 7 of 7

MIN Function Without Using Array

  1. #1
    Registered User
    Join Date
    11-21-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    99

    MIN Function Without Using Array

    I would be very grateful if one of Excel gurus can help me to to use MIN function without using array, even if it requires adding several additional columns. I have thousands of the records and the array function that I use below tremendously slows down Excel performance. I attached the data sample.

    MIN array formula that I use: {=IF(NOT(ISBLANK(D2)),(MIN(IF($D$2:$D$20000=D2,$B$2:$B$20000,""))))}

    In column 'C' I need to return the MIN time stamp for each unique value from "Deployed?" column as it is displayed in my attached data sample when I used an array formula.

    For example, there is one of unique values in column "Deployed ?", such as 'retlatency_RZ042015'.
    I need to search the earliest time (MIN or SMALL function) for this value in column 'B' and for each row where 'retlatency_RZ042015' is displaed return earliest time stamp, such as '4/20/2015 11:21 PM' in column 'C'.

    Thanks so much!

    DATA.xlsx

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: MIN Function Without Using Array

    Hi Neyme,

    Since you use excel 2010 you can take advantage of AGGREGATE function. Although this is an array formula, it does not require CTRL+SHIFT+ENTER confirmation

    =IF(D2="","",AGGREGATE(15,6,B$2:B$20000/(($D$2:D$20000=D2)),1))
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Registered User
    Join Date
    11-21-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: MIN Function Without Using Array

    Hi AlKey,

    Two questions for you:

    1. What else can I do to speed up Excel performance? Your formula worked very well and accelerated Excel performance from 2.5 min to 30 sec. Is it possible still fine tune the formula so it will take 5-10 sec to update 10K-20K rows?

    2. Can you please explain AGGREGATE formula? I understand the first part of it ('AGGREGATE(15,6,B$2:B$20000'), but what is the division sign '/' means?

    Thank you SO MUCH for taking time to help me and answer all my questions!!!!

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: MIN Function Without Using Array

    There many thing should be considered when it comes to performance improvement so here a link that you might find useful.

    https://msdn.microsoft.com/en-us/lib...or=-2147217396

    The AGGREGATE function is actually can be viewed as Swiss Knife and it was first introduced in Excel 2010. It's more like a collection of functions which include 19 different functions.
    Here is more info

    https://support.office.com/en-sg/art...f-04346623d79d



    Please don't forget to thank those who helped by clicking on Add Reputation * and please mark thread as "Solved" if your issue has been resolved. (Selecting Thread Tools-> Mark thread as Solved).

  5. #5
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: MIN Function Without Using Array

    One thing that I frequently see in these kind of questions is "duplicated effort" (see discussion in AlKey's first link to performance improvement. First rule under "speeding up calculations and reducing obstructions" about 3/4 of the way down). In your sample file, for example, there are 120 instances of "retlatency_rz0402015". For each instance, Excel must repeat the same calculation. One key step to speeding up the calculation will be to eliminate this redundancy. I would probably suggest something like:

    Build a lookup table:

    1) Identify each unique entry in column D. I don't off hand know how to best do this. A quick look down the list suggests that there are three unique values in this list. Enter these unique entries in the left column of the lookup table.
    2) For each entry in the lookup table, use your MIN((IF(...)) array formula.

    Now, For each entry in column C in the main table, you can enter a simpler lookup function (=VLOOKUP(D4,lookup_table,2,false)) that will return the previously calculated time stamp.

    Expanding your sample down to ~4700 rows, the original functions took 13 to 15 seconds to calculate. This lookup table approach was near instantaneous.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  6. #6
    Registered User
    Join Date
    11-21-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: MIN Function Without Using Array

    Hi AlKey,

    I am very grateful for your help! The article about AGGREGATE function doesn't explain divide sign '/' that you used in your formula. I am trying to learn as much as possible in order to be able to tackle the formulas by myself.

    I added a reputation to your profile.

  7. #7
    Registered User
    Join Date
    11-21-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: MIN Function Without Using Array

    Hi Mr. Shorty,

    Thanks so much for taking the time to provide me with an advise. I'll try your approach because I definitely need to speed up the performance. I also added reputation to you as well.

+ 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. index function error using match function to get data from a cell in an array
    By mabildgaard in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-17-2013, 02:21 AM
  2. Array function only displays first value of array as output
    By q-tip in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-04-2013, 12:51 PM
  3. SEARCH function returns array if first argument is array--Huh?
    By 6StringJazzer in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-10-2012, 07:23 PM
  4. Using the ReDim array function in a multidimensional array in excel
    By Doruli in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-05-2012, 01:43 PM
  5. Read Range To Array, Then Pass Array To Function
    By ProbablyNotARealName in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-20-2010, 12:29 PM

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