+ Reply to Thread
Results 1 to 10 of 10

Aggregate function with condition

Hybrid View

  1. #1
    Registered User
    Join Date
    06-23-2017
    Location
    Jacksonville, FL
    MS-Off Ver
    Windows 7
    Posts
    5

    Aggregate function with condition

    I have a few columns of data and I am trying to find the top 3 highest values in one column based on meeting one condition in the other column. I also want to ignore hidden rows in my data since I use filters. I am using the AGGREGATE function as follows but it will not ignore hidden rows when I filter the data. Any help would be greatly appreciated.

    AGGREGATE(14,5,D3:D17*(F3:F17=B4),1)

  2. #2
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Aggregate function with condition

    =AGGREGATE(14,5,IF(F3:F17=B4,D3:D17),1) as array formula

  3. #3
    Registered User
    Join Date
    06-23-2017
    Location
    Jacksonville, FL
    MS-Off Ver
    Windows 7
    Posts
    5

    Re: Aggregate function with condition

    Thanks but unfortunately still not ignoring hidden rows when I filter. I've attached a simple example.
    Attached Files Attached Files
    Last edited by buttonman; 06-23-2017 at 03:56 PM.

  4. #4
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,279

    Re: Aggregate function with condition

    Which excel version you using. Aggregate function applies to Excel 2016, Excel 2013, Excel 2011 for Mac, Excel 2010
    Instead of aggregate use Large function. I have done some changes in your sheet & using large function with top 3 base on criteria year.
    Refer column "A" "B" "C"
    Look attach file.
    Attached Files Attached Files


    atul


    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".

  5. #5
    Registered User
    Join Date
    06-23-2017
    Location
    Jacksonville, FL
    MS-Off Ver
    Windows 7
    Posts
    5

    Re: Aggregate function with condition

    Thanks AVK. I use Excel 2013. Unfortunately, your formula does not ignore hidden rows when I filter. For example, pull "4" out of stage column via filter and the answer in cell C1 does not change. Any of ideas? Thank you.

  6. #6
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Aggregate function with condition

    NOTE: The function will not ignore hidden rows, nested subtotals or nested aggregates if the array argument includes a calculation, for example: =AGGREGATE(14,3,A1:A100*(A1:A100>0),1)
    https://support.office.com/en-us/art...6-E19993FA26DF


  7. #7
    Registered User
    Join Date
    06-23-2017
    Location
    Jacksonville, FL
    MS-Off Ver
    Windows 7
    Posts
    5

    Re: Aggregate function with condition

    Thanks Tim. I looked at that a few times but clearly missed that note. Any other ideas on how I could accomplish this task?

  8. #8
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Aggregate function with condition

    =large(subtotal(9,offset(d2,row(a1:a15),))*(f3:f17=b1),1)

  9. #9
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Aggregate function with condition

    The Aggregate-function can't handle the marked part of the formula
    Formula: copy to clipboard
    =AGGREGATE(14,5,D3:D17*(F3:F17=B4),1)

    In the attached workbook I introduced a helper column which deals with that part of the formula.
    Also introduced a cell where one of the years is selected. The helper column looks at the selection cell.
    Changed your aggregate-formula to look at the helper column.

    Alternatively - if you don't want to use the helper column and the selection cell - you could just leave out the marked part of the formula and manualy filter the year column.
    Attached Files Attached Files
    Last edited by Tsjallie; 06-23-2017 at 05:17 PM.
    Cheers!
    Tsjallie




    --------
    If your problem is solved, pls mark the thread SOLVED (see Thread Tools in the menu above). Thank you!

    If you think design is an expensive waste of time, try doing without ...

  10. #10
    Registered User
    Join Date
    06-23-2017
    Location
    Jacksonville, FL
    MS-Off Ver
    Windows 7
    Posts
    5

    Re: Aggregate function with condition

    Finally getting back to this issue. Thank you Tim. That last formula worked beautifully!

+ 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. [SOLVED] VBA Aggregate Function
    By Gregor y in forum Access Programming / VBA / Macros
    Replies: 9
    Last Post: 02-27-2017, 03:17 AM
  2. [SOLVED] Aggregate function is not woring
    By shukla.ankur281190 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-19-2016, 07:15 AM
  3. Function AGGREGATE and FREQUENCY
    By XLalbania in forum Excel General
    Replies: 9
    Last Post: 02-22-2016, 05:11 PM
  4. [SOLVED] AGGREGATE Function
    By chief_abound in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-03-2015, 12:48 AM
  5. Aggregate Function Using Sum
    By gtbaseball7 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-01-2015, 02:19 PM
  6. Aggregate Function
    By nav505 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-04-2013, 03:20 AM
  7. Aggregate function
    By stefantem in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-19-2006, 04:47 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