+ Reply to Thread
Results 1 to 6 of 6

Help with AVERAGEIFS with last row

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-12-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016 in 2024
    Posts
    857

    Help with AVERAGEIFS with last row

    Hi all

    I am having trouble with the below formula and referencing the last row:

    Range("E16").Formula = "=AVERAGEIFS($H$22:$H$" & lastrow & ", $W$22:$W$" & lastrow & "=1,$H$22:$H$" & lastrow & ","">=""&E12,$H$22:$H$" & lastrow & ",""<=""&F12)"

    I get 'Application-defined or object-defined error. Does anyone know where I'm going wrong?

    Thanks

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,809

    Re: Help with AVERAGEIFS with last row

    Try:
    Range("E16").Formula = "=AVERAGEIFS($H$22:$H$" & lastrow & ", $W$22:$W$" & lastrow & ",1,$H$22:$H$" & lastrow & ","">=""&E12,$H$22:$H$" & lastrow & ",""<=""&F12)"
    That is, change "=1" to ",1"
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    10-12-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016 in 2024
    Posts
    857

    Re: Help with AVERAGEIFS with last row

    thank you TMS I couldn't quite figure it out.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,809

    Re: Help with AVERAGEIFS with last row

    You're welcome.

    Not easy, just looking at it. I first put a space in front of the equals sign (in the formula) to see what was generated. Then copied that, without the space, and put it in a cell to see what error message Excel generated, rather than VBA. Then you see that it's "too few parameters" which gives you the clue.

  5. #5
    Forum Contributor
    Join Date
    10-12-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016 in 2024
    Posts
    857

    Re: Help with AVERAGEIFS with last row

    Good feedback. Thank you again

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,809

    Re: Help with AVERAGEIFS with last row

    You're welcome. Thanks for the rep.

+ 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. AVERAGEIFS can you use it with an or.
    By Vokey9 in forum Excel Formulas & Functions
    Replies: 21
    Last Post: 02-26-2016, 05:05 PM
  2. Averageifs
    By Tim Bos in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-26-2015, 09:41 AM
  3. [SOLVED] Averageifs
    By yuenk in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 07-07-2015, 10:59 AM
  4. [SOLVED] IF NOT IN with AVERAGEIFS
    By trizzo in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-10-2014, 04:44 PM
  5. [SOLVED] AverageIfs, Max and Min
    By Odie2012 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-11-2012, 07:57 PM
  6. [SOLVED] MIN and MAX like an AVERAGEIFS?
    By superchill435 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-10-2012, 09:06 AM
  7. AverageIfs
    By DMAN11 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-07-2010, 05:31 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