+ Reply to Thread
Results 1 to 4 of 4

WorksheetFunction.AverageIfs() Error

  1. #1
    Registered User
    Join Date
    05-01-2020
    Location
    Sao Paulo
    MS-Off Ver
    365
    Posts
    4

    WorksheetFunction.AverageIfs() Error

    I am having some issues to calculate an average number using WorksheetFunction.AverageIfs() with 5 different conditions (each one in a different range).
    And when I run the code a Run time Error occurs (Unable to get the AverageIfs properties of the WorkSheet function).

    There are two workbooks that I use, one with the database (data.xlsx) and another that I consolidate the data.

    What I am trying to do is to calculate the average number of days that i have to perform each set of contracts that start on the same day for each starting date (some contracts start on the same date but have different deadlines).
    Data regarding contract duration is available in the database.

    What I observed is that the error occurs on the first date iteration probably because the second outcome is #DIV/0! (I tried using the excel formula and that's what happened - maybe the system doesn't deal very well with such error). But I am not sure about this conclusion

    What should I do to avoid such problem? How can I circumvent this issue?

    I attached both the samble database and the macro file

    Thanks

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,713

    Re: WorksheetFunction.AverageIfs() Error

    Hey Guslume,

    You can remove the "worksheetfunction" & write your formula code like below to show the errors if the date is not found in your "data" sheet. By the way, I think your formula is missing the 4th condition which I have added for you

    Please Login or Register  to view this content.
    Alternatively, if you don't wish to show the error (which I prefer), you could add one variant type variable & check if the result is error, assign a zero or any other value as you wish to the cell like below

    Please Login or Register  to view this content.
    Last edited by nankw83; 05-28-2020 at 04:18 AM.
    If I was able to help, you can thank me by clicking the * Add Reputation under my user name

  3. #3
    Registered User
    Join Date
    05-01-2020
    Location
    Sao Paulo
    MS-Off Ver
    365
    Posts
    4

    Re: WorksheetFunction.AverageIfs() Error

    Thank you for the help nankw83
    Your suggestion was very helpful and you were right about the 4th condition being missed

    I tried the code you wrote and it worked like a charm!

    Thanks again!

  4. #4
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,713

    Re: WorksheetFunction.AverageIfs() Error

    Glad to help & thanks for the reps

    If the suggested solution takes care of your original question, please take a moment & mark this thread as 'SOLVED' from the Thread Tools at top menu bar above your first post

+ 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] Getting #DIV/O! error when using AverageIFS
    By chriswrcg in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-19-2019, 12:46 PM
  2. [SOLVED] Averageifs – error Value
    By pauldaddyadams in forum Excel General
    Replies: 3
    Last Post: 02-05-2016, 11:40 AM
  3. [SOLVED] Value error on Averageifs
    By leem in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-08-2015, 02:55 PM
  4. DIV/0 error with AVERAGEIFS
    By pcp2010 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 03-13-2013, 10:01 AM
  5. AverageIFS with Div/0 error
    By Nemoren in forum Excel General
    Replies: 13
    Last Post: 05-03-2012, 09:33 AM
  6. Worksheetfunction.averageifs not functioning. run-time eror: 1004
    By Lifeseeker in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-05-2012, 04:45 PM
  7. worksheetfunction.sum error
    By Monique in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-17-2005, 12:05 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