+ Reply to Thread
Results 1 to 4 of 4

IF/THEN & a SUMIF & COUNTIF Formula

  1. #1
    Forum Contributor dagindi's Avatar
    Join Date
    06-02-2008
    Location
    New York, NY
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    295

    IF/THEN & a SUMIF & COUNTIF Formula

    I am using the following formula to total "withdrawals" (represented by negative numbers) from a column and then dividing it by the count and multiplying it to get the positive average:


    Please Login or Register  to view this content.
    Works great except when there is nothing in the column, then you get the good ole #/DIV0! error.

    I played around with a few different IF/THEN statements (two samples below) and none of them are being accepted.

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    What am I missing??

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: IF/THEN & a SUMIF & COUNTIF Formula

    Maybe =-SUMIF(G11:G250,"<0") / MAX(1, COUNTIF(G11:G250,"<0"))
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor dagindi's Avatar
    Join Date
    06-02-2008
    Location
    New York, NY
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    295

    Re: IF/THEN & a SUMIF & COUNTIF Formula

    Shg,

    Works perfectly! Who would of thought you can put a "-" before the SumIf to make the result positive.

    I am dissecting the formula you provided and I understand most of it.

    I cant figure out how the "Max(1,...)" affects the formula to return the result if >0 or the "0" if <0.

    Can you give me a brief explanation on this?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: IF/THEN & a SUMIF & COUNTIF Formula

    If the are no numbers <0 among B11:G250, the COUNTIF returns 0. The MAX function chooses the larger of that or 1 as the denominator.

+ 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