+ Reply to Thread
Results 1 to 8 of 8

Aggregate Function Not Working As Expected

  1. #1
    Registered User
    Join Date
    10-26-2012
    Location
    Place, United States
    MS-Off Ver
    Excel 2003
    Posts
    12

    Aggregate Function Not Working As Expected

    I have a range of values, for example R11:R25, for which I need to reciprocate and take the average. I need to do this all in one step, using a function, and the range may contain blank cells. If I try to reciprocate the blank cells I get a DIV/0 error so I'm trying to use the aggregate function as follows to work around that:

    =AGGREGATE(1, 6, 1/(R11:R25)).

    Based on my understanding this should take the array of values R11:R25; reciprocate them and then, ignoring errors, calculate the average. However, the function isn't working as expected and is giving a #VALUE! error. Is anyone able to explain why this doesn't work and how I might achieve my stated goal?

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Aggregate Function Not Working As Expected

    The Aggregate function will only work with Arrays in the options 14 and above.

    I think you'll need to do

    =AVERAGE(IF(ISNUMBER(R11:R25),IF(R11:R25<>0,1/R11:R25)))

    Entered as an array with CTRL + SHIFT + ENTER

  3. #3
    Forum Contributor
    Join Date
    12-16-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    109

    Re: Aggregate Function Not Working As Expected

    I just made a video this morning on using aggregate function

    =AGGREGATE(1,6,A2:A100) I think you might have an extra 1 in there
    https://www.youtube.com/watch?v=DACXUZJfNo8

    http://www.easyexcelanswers.com

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Aggregate Function Not Working As Expected

    Wait, is that the only reason you added the 1/ ? As an attempt to 'Cause' an error so that Aggregate would ignore it?
    So you're not wanting the average of 1/R11 1/R12 1/R13 etc ?

    The plain old Average function will ignore blanks by itself.
    =AVERAGE(R11:R25)

  5. #5
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: Aggregate Function Not Working As Expected

    Try an array formula:

    Please Login or Register  to view this content.
    Confirm as an array formula with Ctrl-Shift-Enter

    Cheers,
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

  6. #6
    Registered User
    Join Date
    10-26-2012
    Location
    Place, United States
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Aggregate Function Not Working As Expected

    All,

    Thanks for the replies. Yes, an array formula is an obvious way to go but needs to be avoided because of the slow speed at which they calculate in large files. I took the reciprocal in the aggregate function because I'm trying to average the reciprocals of the values in the specified range. So there's no way to do this without an array formula?

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,152

    Re: Aggregate Function Not Working As Expected

    Calculate reciprocals in "helper" column and average these?

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Aggregate Function Not Working As Expected

    Sure, create another column with =IFERROR(1/R11, "") copied down and then take the average of that column. You can always hide that second column or even put it on a different sheet. This would be much faster than a large array. Why are people so anti helper columns?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

+ 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] worksheets function not working as expected
    By elmasguapo in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-15-2015, 05:18 AM
  2. [SOLVED] CountIfS not working as expected
    By rschoenb in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-12-2014, 11:45 PM
  3. Networkdays function not working as expected
    By Rem0ram in forum Excel Formulas & Functions
    Replies: 20
    Last Post: 07-02-2014, 09:29 AM
  4. Replies: 6
    Last Post: 05-07-2012, 10:49 AM
  5. [SOLVED] IF statement is not working as expected?
    By Aland2929 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-31-2009, 02:02 PM
  6. [SOLVED] Lookup Not working as expected
    By trumpy81 in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 06-30-2005, 03:05 PM
  7. [SOLVED] Hyperlink Function not working as expected
    By Hari Prasadh in forum Excel General
    Replies: 2
    Last Post: 04-16-2005, 09:08 AM

Tags for this Thread

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