+ Reply to Thread
Results 1 to 11 of 11

AVERAGEIFS with "AND" and "OR" criteria

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

    AVERAGEIFS with "AND" and "OR" criteria

    Hi

    I have an AVERAGEIFS formula with multiple criteria that I cannot get to work:

    Please Login or Register  to view this content.
    The "OR" criteria includes "GOOD*" (which includes multiple "GOOD" criteria) and then I need to also include "DEAD" and "DEAD4". I cannot use "DEAD*" as I need to include other versions of "DEAD" in a different formula.

    Does anyone know how I can achieve this?

  2. #2
    Forum Contributor
    Join Date
    05-06-2016
    Location
    Cluj, Romania
    MS-Off Ver
    2007-2010
    Posts
    220

    Re: AVERAGEIFS with "AND" and "OR" criteria

    Hi,
    try this
    Formula: copy to clipboard
    Please Login or Register  to view this content.

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

    Re: AVERAGEIFS with "AND" and "OR" criteria

    thank you that has worked. I am trying to write the formula in VBA but getting stuck here:

    Please Login or Register  to view this content.
    Can anyone help me here?

  4. #4
    Forum Contributor
    Join Date
    05-06-2016
    Location
    Cluj, Romania
    MS-Off Ver
    2007-2010
    Posts
    220

    Re: AVERAGEIFS with "AND" and "OR" criteria

    try something like this

    dim i as long
    dim sum as double, nr as long, average as double
    with worksheets("Output")
    for i=26 to 31876
    if .range("U"&i) ="WIN" and .... then
    sum=sum+.range("U"&i)
    nr=nr+1
    end if
    end with
    average=sum/nr
    next i

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

    Re: AVERAGEIFS with "AND" and "OR" criteria

    thank you

    However I have a number of similar formulas across columns, could the formula above be written directly into VBA?

  6. #6
    Forum Contributor
    Join Date
    05-06-2016
    Location
    Cluj, Romania
    MS-Off Ver
    2007-2010
    Posts
    220

    Re: AVERAGEIFS with "AND" and "OR" criteria

    put a sample file in attachament
    you can resolve this without VBA or can write a UDF formula in VBA but I need the file

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

    Re: AVERAGEIFS with "AND" and "OR" criteria

    ok here is sample file

    the data will always change which is why I am using VBA to insert the formulas
    Attached Files Attached Files

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

    Re: AVERAGEIFS with "AND" and "OR" criteria

    I will post in VBA forum to see if anyone can assist me there.

  9. #9
    Forum Contributor
    Join Date
    05-06-2016
    Location
    Cluj, Romania
    MS-Off Ver
    2007-2010
    Posts
    220

    Re: AVERAGEIFS with "AND" and "OR" criteria

    if you want to insert formula in cell try this
    Please Login or Register  to view this content.
    or you must insert double "" in formula
    e.g.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    range("A2").formula="=A1&""XYZ"""

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

    Re: AVERAGEIFS with "AND" and "OR" criteria

    thank you but I'm afraid I don't understand??

  11. #11
    Forum Contributor
    Join Date
    05-06-2016
    Location
    Cluj, Romania
    MS-Off Ver
    2007-2010
    Posts
    220

    Re: AVERAGEIFS with "AND" and "OR" criteria

    I'm not sure if I understand very well what you want.
    Take a look in the attachment file and see if it does what you want.
    Attached Files Attached Files

+ 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. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  2. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  3. [SOLVED] Find multiple "text" criteria and return as ""Yes" in Matrix
    By bertrand82 in forum Excel General
    Replies: 11
    Last Post: 04-30-2012, 09:20 AM
  4. Replies: 5
    Last Post: 10-12-2010, 06:46 AM
  5. Replies: 0
    Last Post: 07-09-2009, 04:07 PM
  6. Replies: 5
    Last Post: 06-26-2006, 09:23 PM
  7. Replies: 7
    Last Post: 05-13-2006, 05:02 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