+ Reply to Thread
Results 1 to 4 of 4

Difference between these array formulae

  1. #1
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Difference between these array formulae

    Hi guys, I am not very well versed with formulae, and especially not for array formulae, would like to know the difference between these two examples.

    Found some help through Googling, and made these up. Basically, to mimic SUMIFS/COUNTIFS formulae, except for MAX instead.

    I am comparing 3 columns, and return a 4th column if all matched, then get the max of the returned value.

    Formula 1:
    Please Login or Register  to view this content.
    Formula 2:
    Please Login or Register  to view this content.
    The first formula used the AND function to perform 3 conditions at once, but it doesn't work.
    The second formula is a nested IF's, and it works fine.
    To me, both formulae should be logically working the same, but why wouldn't the first one work? Could anyone please enlighten? Thanks!
    多么想要告诉你 我好喜欢你

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Difference between these array formulae

    In Array formula's * replaces the AND() function


    So your initial (Array) formula should be like this...

    =MAX(IF(($N$2:$N$10000="AB")*($D$2:$D$10000=D2)*($E$2:$E$10000=E2),$O$2:$O$10000))


    Your second formula will work faster than the first one. Because the nedsted If() will exit soon and will not compare all the conditions like the first one.

    =MAX(IF($N$2:$N$10000="AB",IF($D$2:$D$10000=D2,IF($E$2:$E$10000=E2,$O$2:$O$10000))))


    Also you can go for Sumproduct() approach to avoid Ctl+Shif+Enter keyboard entry

    =SUMPRODUCT(MAX(($N$2:$N$10000="AB")*($D$2:$D$10000=D2)*($E$2:$E$10000=E2),$O$2:$O$10000))


    If you are using Excel >=2010 then you can try =AGGREGATE() function which avoids Ctl+Shif+Enter keyboard entry


    =AGGREGATE(14,6,($N$2:$N$10000="AB")*($D$2:$D$10000=D2)*($E$2:$E$10000=E2)*$O$2:$O$10000,1)


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,964

    Re: Difference between these array formulae

    Im not sure the 1st array is permitted, but here is a 3rd version...
    =MAX(IF(($N$2:$N$10000="AB")*($D$2:$D$10000=D2)*($E$2:$E$10000=E2),$O$2:$O$10000))
    Also array ebtered
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Difference between these array formulae

    Quote Originally Posted by :) Sixthsense :) View Post
    In Array formula's * replaces the AND() function
    That's nice to know. I probably read that somewhere else before but obviously it didn't get into my long-term memory.

    Thank you, both of you, for the examples.

+ 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. Excel 2007 : Formulae time difference
    By Diamant in forum Excel General
    Replies: 2
    Last Post: 01-29-2012, 05:14 AM
  2. Using Variable array formulae
    By empsall in forum Excel General
    Replies: 8
    Last Post: 08-08-2009, 01:39 PM
  3. Array Formulae
    By kbsudhir in forum Excel General
    Replies: 1
    Last Post: 05-05-2009, 02:17 PM
  4. Replies: 2
    Last Post: 11-14-2006, 02:32 PM
  5. [SOLVED] OFFSET and array formulae
    By Wazooli in forum Excel General
    Replies: 3
    Last Post: 01-19-2005, 09:06 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