+ Reply to Thread
Results 1 to 13 of 13

Average based on 2 critera

Hybrid View

  1. #1
    Registered User
    Join Date
    01-02-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    21

    Average based on 2 critera

    Hi, I've had a really good look through previous posts and I'm so almost at my answer but it just doesn't work. So I am calling on greater knowledge!
    I have attached an example. I need to populate Cell H3 with an average Capacity from Column E but I only need it to calculate those that match, in this case I & M from colums C&D which contain information stripped out form Column B
    I have tried using this formula
    AVERAGE(IF((C2:C350="I")*(D2:D350="M"),E2:E350))
    and I've tried to enter as an array but it won't let me. Can anyone see where I am going wrong as I have wasted most of the day on this!!!

    Also just to complicate things more after I have this working I will need to look at this based only on dates that have already passed. What amendments will I need to make to the formula to get it to look for dtaes in the past?
    ThanksExample.xlsx

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Average based on 2 critera

    works fine for me
    but you can use averageifs() in 2007
    Attached Files Attached Files
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    01-02-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Average based on 2 critera

    Thanks for your response
    Strange- I've just entered the forumula into my example and it returns 0 which I am sure isn't right. Was going to upload the spreadsheet again but can't seem to do it

  4. #4
    Registered User
    Join Date
    01-02-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Average based on 2 critera

    Example.xlsx
    Figured out how to attach it

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,698

    Re: Average based on 2 critera

    Did you try AVERAGEIFS as Martin suggested, you don't need to "array enter" it

    =AVERAGEIFS(E2:E350,C2:C350,"I",D2:D350,"M")
    Audere est facere

  6. #6
    Registered User
    Join Date
    01-02-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Average based on 2 critera

    Quote Originally Posted by daddylonglegs View Post
    Did you try AVERAGEIFS as Martin suggested, you don't need to "array enter" it

    =AVERAGEIFS(E2:E350,C2:C350,"I",D2:D350,"M")
    Not yet as I wans't sure how or whether I was in Excel 2007!!
    Will go and try it now. Thanks

  7. #7
    Registered User
    Join Date
    01-02-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Average based on 2 critera

    Thanks you so much that worked :-)
    How would I manipulate that to look only for dates that are before today?

  8. #8
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,698

    Re: Average based on 2 critera

    You can keep adding criteria, so try

    =AVERAGEIFS(E2:E350,C2:C350,"I",D2:D350,"M",A2:A350,"<"&TODAY())

  9. #9
    Registered User
    Join Date
    01-02-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Average based on 2 critera

    Thank you, it's now come at DIV/O) but I think that's to do with my figures. I'm almost there. Really appreciate your help. Thanks

  10. #10
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Average based on 2 critera

    0.28482379
    is the result array entered formula why are you not seeing that? how are you entering the array?

  11. #11
    Registered User
    Join Date
    01-02-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Average based on 2 critera

    Quote Originally Posted by martindwilson View Post
    0.28482379
    is the result array entered formula why are you not seeing that? how are you entering the array?
    Ctrl+ Shift+ ENTER but it's not putting the {} signs in as it used to . I am in a different computer than the last time I tried to do it

  12. #12
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Average based on 2 critera

    if you have already entered the formula make sure you clicking in the formula bar not the cell

  13. #13
    Registered User
    Join Date
    01-02-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Average based on 2 critera

    Yup doing that, tried positioning cursor at end and selecting whole formula and trying it. I think tbh it's an issue with my computer as it's a wise box to a server and it has random issues like this!! Thanks for your help the Averageifs has worked just trying to get the dates sorted now. Oh well it's filled a day :-)

+ 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