+ Reply to Thread
Results 1 to 6 of 6

VBA code for AverageIfs with multiple criteria

  1. #1
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    696

    VBA code for AverageIfs with multiple criteria

    Hi,

    Can anyone help me? how to write code for AverageIfs with multiple criteria

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor pareshj's Avatar
    Join Date
    05-20-2014
    Location
    MUMBAI
    MS-Off Ver
    2007 & 2010
    Posts
    447

    Re: VBA code for AverageIfs with multiple criteria

    Hi Farid,

    Check out the below link and hope this will help:

    http://www.excelforum.com/excel-gene...onditions.html


    Regards,
    Paresh J
    Click on "* Add Reputation" as a way to say thanks

  3. #3
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: VBA code for AverageIfs with multiple criteria

    Hi Paresh,

    This is sample for number while my requirement is for string.


    I am understand we can use Application.WorksheetsFunction.Averageifs(rng, rng, ">=3", rng, "<=5")

    while it is imposible to use Application.WorksheetsFunction.Averageifs(rng, rng, "Officer", rng, "Executive")

  4. #4
    Forum Contributor pareshj's Avatar
    Join Date
    05-20-2014
    Location
    MUMBAI
    MS-Off Ver
    2007 & 2010
    Posts
    447

    Re: VBA code for AverageIfs with multiple criteria

    Hi Farid,

    Check my version of AverageIFS file. It is working fine with string too.

    AverageIFS.xlsm


    Note: To check your code, I would suggest you to break up your code into fragments. Like, just comment your for loop, hardcode some values and check whether it is giving output.

    Regards,
    Paresh J

  5. #5
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: VBA code for AverageIfs with multiple criteria

    Hi paresh,

    Please look at my request. multiple criteria in the same criteria range.

    e.g. your data in column B consist of more 4 categories (North, South,West, East). then, I want to calculate average for North & South

    I can't use this,
    Please Login or Register  to view this content.

    I am a bit confused whether we can use SumProduct in VBA code
    Last edited by Faridwahidi; 08-27-2014 at 11:36 AM.

  6. #6
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: VBA code for AverageIfs with multiple criteria

    Hi All,

    Can anyone help me?

    I really confused on how to calculate Average with multiple criteria in the same criteria range in VBA. (The criteria is string not a number)

    Application.WorksheetsFunction.AverageIfs seems not applicable for string criteria.

+ 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] Macro for AverageIFS, with multiple criteria in the same criteria range
    By Faridwahidi in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 05-24-2014, 01:13 AM
  2. [SOLVED] AVERAGEIFS with multiple criteria
    By bibu in forum Excel General
    Replies: 5
    Last Post: 03-22-2014, 03:28 PM
  3. AVERAGEIFS(), with multiple criteria
    By Jkember in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-21-2014, 06:33 PM
  4. AVERAGEIFS Multiple Criteria
    By qhoney in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-05-2014, 03:58 PM
  5. [SOLVED] Averageifs with multiple criteria
    By jbillyo in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-02-2013, 04:13 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