+ Reply to Thread
Results 1 to 3 of 3

How do you write an AND or OR statement in an AVERAGEIFS formula?

  1. #1
    Registered User
    Join Date
    09-25-2012
    Location
    San Antonio, Texas
    MS-Off Ver
    Excel 2003
    Posts
    21

    How do you write an AND or OR statement in an AVERAGEIFS formula?

    I'm writing a formula that takes an average from a column based on several criteria. The last criteria I'm checking for is the time, and I've broken it into day (6:00 am-5:59 pm) and night (6:00 pm-5:59 am). I was unsuccessful in using the Hour() function in the formula itself, so I've used it in another column that returns an hour value based on the "time" column.

    The criteria are mostly identical for the "day" and "night" averages, except for the "time" criteria. I need the "day" column to only average values in which the "time" value is greater than 5 and smaller than 18, and the night column to average those in which the "time" is less than 6 or greater than 17.

    Here's the actual formula I'm using for "day":

    =AVERAGEIFS(INDIRECT($P6&"!P:P"),INDIRECT($P6&"!E:E"),$Q6,INDIRECT($P6&"!S:S"),">5",INDIRECT($P6&"!S:S"),"<18")

    I'm able to handle the AND portion by just separating it into two different criteria sets. But for the "night" portion I need an OR formula ("<6" or ">17").

    Additionally, if it's possible to cut out the separate column for the Hour() that I mentioned above and work it directly into the final criteria, that'd be handy to know.

    Thanks for your time.

  2. #2
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: How do you write an AND or OR statement in an AVERAGEIFS formula?

    can you upload an example? i'm tempted to use another approach, will be easier to show than explain
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  3. #3
    Registered User
    Join Date
    09-25-2012
    Location
    San Antonio, Texas
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: How do you write an AND or OR statement in an AVERAGEIFS formula?

    Trimmed it a bit, but this should still show what I'm going for. Relevant formulas are in Time!T7:U8.
    Attached Files Attached Files
    Last edited by ndrobinson; 07-16-2013 at 04:53 PM.

+ 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] Averageifs with an or statement
    By kerrold1 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-01-2013, 10:41 AM
  2. AverageIfs Statement Counting Zeros
    By Anthem12 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-08-2013, 12:24 AM
  3. [SOLVED] Excel 2007 : Help (again) with AVERAGEIFS formula
    By milliemoo in forum Excel General
    Replies: 9
    Last Post: 03-27-2012, 09:37 AM
  4. Need help averageifs formula
    By lliam79 in forum Excel General
    Replies: 3
    Last Post: 09-23-2011, 02:44 AM
  5. creating dynamic conditional statement for averageifs
    By olsoniv in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-16-2011, 11:33 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