+ Reply to Thread
Results 1 to 7 of 7

Average with more than one condition

  1. #1
    Registered User
    Join Date
    03-29-2011
    Location
    New York
    MS-Off Ver
    Excel 2011
    Posts
    6

    Average with more than one condition

    Hi guys.

    So I have a spreadsheet that estimates my earnings per month. Since my earnings really are in a world over their own over the weekends (they are only 30% of normal) I am trying to count weekends separately.

    I've set up Column A - day of the month, Column B - which tells me "true" if the day in question falls on a weekend, and "false" if it falls during the week. Column C tells me my earnings for that day.

    With me so far? Ok, so here's the formula I've come up with that tells me my average earnings during the week:

    Please Login or Register  to view this content.
    and this formula tells me my average earnings during weekends:

    Please Login or Register  to view this content.
    However, the one glaring problem in these formulas is that they incorrectly handle values of zero. Supposing a month is 31 days long, and it's the 16th of the month - the formula assumes that the 0s from the 17th of the month until the 31st of the month are actual earnings! So the formula doesn't represent my true average, not unless it "ignores" the zeroes.

    How do I force it to ignore zeros?

    For instance, for avg. minutes per weekday the formula needs to find the average earnings for days marked "False" and only consider numbers that are >0.

    Appreciate any help you can give!!!
    Last edited by wasafiri; 03-30-2011 at 03:21 PM. Reason: clarity

  2. #2
    Forum Contributor bentleybob's Avatar
    Join Date
    02-27-2009
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    644

    Re: Need help with Excel formula

    SUMIFS and COUNTIFS.

  3. #3
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Need help with Excel formula

    Welcome to the Forum but it's just a matter of time before a Mod asks you to change your thread title so I'll give you a heads up by referring you to the Forum Rules.

    Click on the Forum Rules link at the top of the page and pay particular attention to Rule #1.

  4. #4
    Registered User
    Join Date
    03-29-2011
    Location
    New York
    MS-Off Ver
    Excel 2011
    Posts
    6

    Re: Need help with Excel formula

    Quote Originally Posted by bentleybob View Post
    SUMIFS and COUNTIFS.
    What do you mean?

    Quote Originally Posted by Cutter View Post
    Welcome to the Forum but it's just a matter of time before a Mod asks you to change your thread title so I'll give you a heads up by referring you to the Forum Rules.

    Click on the Forum Rules link at the top of the page and pay particular attention to Rule #1.
    Thanks, oversight on my part, edited for clarity.

  5. #5
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Average with more than one condition

    Try something like:

    =SUMIFS(C2:C32,C2:C32,">0",B2:B32,"FALSE") to give you the sum of values that are above 0 and adjacent to FALSE.

    Here are links you may be interested in: SUMIFS(), COUNTIFS() and AVERAGEIFS()

    http://www.excelfunctions.net/Excel-...-Function.html

    http://www.excelfunctions.net/Excel-...-Function.html

    http://www.excelfunctions.net/Excel-...-Function.html


    EDIT: You can just change the "SUM" to "AVERAGE" in the above formula to get what you want. To get a count just change the "SUM" to "COUNT" and remove the first "C2:C32,".
    Last edited by Cutter; 03-29-2011 at 09:43 PM.

  6. #6
    Registered User
    Join Date
    03-29-2011
    Location
    New York
    MS-Off Ver
    Excel 2011
    Posts
    6

    Re: Average with more than one condition

    Quote Originally Posted by Cutter View Post
    Try something like:

    =SUMIFS(C2:C32,C2:C32,">0",B2:B32,"FALSE") to give you the sum of values that are above 0 and adjacent to FALSE.

    Here are links you may be interested in: SUMIFS(), COUNTIFS() and AVERAGEIFS()

    http://www.excelfunctions.net/Excel-...-Function.html

    http://www.excelfunctions.net/Excel-...-Function.html

    http://www.excelfunctions.net/Excel-...-Function.html


    EDIT: You can just change the "SUM" to "AVERAGE" in the above formula to get what you want. To get a count just change the "SUM" to "COUNT" and remove the first "C2:C32,".
    Beautiful.... thanks. I was expecting to need some sort of macro - thanks for the very simple solution!

  7. #7
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Average with more than one condition

    You're welcome.

    Don't forget to mark your thread as SOLVED - click the FAQ button at top of page for instructions (if needed).

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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