+ Reply to Thread
Results 1 to 12 of 12

Adding a date stipulation to an average if

  1. #1
    Registered User
    Join Date
    05-31-2012
    Location
    Canada
    MS-Off Ver
    Excel 2011
    Posts
    32

    Adding a date stipulation to an average if

    Hi all,

    I have an average if formula that is working well, but I'd like to add the stipulation that the year of the even must be 2012. I searched online and say a similar request answered with a suggestion of using an array.

    This is what I had that worked:
    =AVERAGEIF(Data!AE:AE,A23,Data!BW:BW)

    Where BW is the column that has the numbers to be averaged and AE is the column that has one stipulation (must be = to A23)

    The array I tried is this:

    =AVERAGE(IF((YEAR(Data!BR3:BR92)=2012)*(Data!AE3:AE92=A23),Data!BW3:BW92))

    The year is in BR.

    Can anyone tell why this isn't working?

    Thanks.

  2. #2
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: Adding a date stipulation to an average if

    Hi,

    Try this,

    =AVERAGE(IF(YEAR(AE2:AE9)=2012,IF(BR2:BR9=A23,$BW$2:$BW$9)))

    This is an array formula and should be commited with Ctr+Shift+Enter

    HTH
    Steve

  3. #3
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Adding a date stipulation to an average if

    Hi Zippersweater,

    A sample workbook would have been helpful but try below :-

    {=AVERAGE(IF((Data!BR3:BR92>=DATE(2012,1,1))*(Data!BR3:BR92<=DATE(2012,12,31))*(Data!AE3:AE92=A23),(Data!BW3:BW92),""))}

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  4. #4
    Registered User
    Join Date
    05-31-2012
    Location
    Canada
    MS-Off Ver
    Excel 2011
    Posts
    32

    Re: Adding a date stipulation to an average if

    Quote Originally Posted by SteveG View Post
    Hi,

    Try this,

    =AVERAGE(IF(YEAR(AE2:AE9)=2012,IF(BR2:BR9=A23,$BW$2:$BW$9)))

    This is an array formula and should be commited with Ctr+Shift+Enter

    HTH
    Steve



    This is the same array but the columns are switched. BR is the one with the dates

  5. #5
    Registered User
    Join Date
    05-31-2012
    Location
    Canada
    MS-Off Ver
    Excel 2011
    Posts
    32

    Re: Adding a date stipulation to an average if

    Quote Originally Posted by dilipandey View Post
    Hi Zippersweater,

    A sample workbook would have been helpful but try below :-

    {=AVERAGE(IF((Data!BR3:BR92>=DATE(2012,1,1))*(Data!BR3:BR92<=DATE(2012,12,31))*(Data!AE3:AE92=A23),(Data!BW3:BW92),""))}

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    This gave me a divide by 0 error.

  6. #6
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: Adding a date stipulation to an average if

    Hi,

    The formula I posted worked on the data I tested it on. I didn't know which column to use based on what you wrote "=AVERAGEIF(Data!AE:AE,A23,Data!BW:BW)" didn't refer to BR at all but the other did. Did you try it? Like I said, it worked for me just change to the columns you're using as needed.

    Steve

  7. #7
    Registered User
    Join Date
    05-31-2012
    Location
    Canada
    MS-Off Ver
    Excel 2011
    Posts
    32

    Re: Adding a date stipulation to an average if

    Yes I tried it and I get a #value error.

  8. #8
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: Adding a date stipulation to an average if

    Did you use Ctrl+Shift+Enter? If not that would return a value error. Can you post a sample workbook?

  9. #9
    Registered User
    Join Date
    05-31-2012
    Location
    Canada
    MS-Off Ver
    Excel 2011
    Posts
    32

    Re: Adding a date stipulation to an average if

    I did use Ctrl+Shift+Enter. I can't/dont know how to post a sample, unfortunately.

  10. #10
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Adding a date stipulation to an average if

    Hi Zipperweater, while replying to this post, click on "Go Advanced" and look for paper clip icon to upload.. thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  11. #11
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: Adding a date stipulation to an average if

    Ok. Here is an example.

    AverageIF.xlsx

  12. #12
    Registered User
    Join Date
    05-31-2012
    Location
    Canada
    MS-Off Ver
    Excel 2011
    Posts
    32

    Re: Adding a date stipulation to an average if

    Thanks all, I got it working thanks to you. this worked:
    =AVERAGEIFS(Data!BW:BW,Data!AE:AE,Installations!A24,Data!BR:BR,">="&DATE(2012,1,1))

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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