+ Reply to Thread
Results 1 to 4 of 4

AverageIf

  1. #1
    LaserDance
    Guest

    AverageIf

    Hi, guys.

    I am trying to find a formula combining IF and AVERAGE. My point is this:
    I have 3 different cells with numbers and want to display the average result in the 4th cell. It works fine only with the AVERAGE function while these numbers are >0. However sometimes I have number 0 in the field. So now, the Average number is not divided by 3, but by the number of cells containing numbers >0. For instance if I have 3, 6, 7 - the average is their sum 3+6+6 / 3 = 5. But if I have 3+6+0, I want the sum to be divided by 2, not by 3.
    Any suggestions ?

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Help on the IAverage function wanted

    If the three cells are in a contiguous range eg A1:C1 then:

    =SUM(A1:C1)/COUNTIF(A1:C1,">0")

    If not contiguous, eg A1,C3,D10 then

    =SUM(A1,C3,D10)/SUM(A1>0,C3>0,D10>0)

    (we're assuming a min of 1 value > 0)

  3. #3
    LaserDance
    Guest

    Re: AverageIf

    Awesome! It works! Thanks a lot.

  4. #4
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: AverageIf

    Quote Originally Posted by LaserDance View Post
    Awesome! It works! Thanks a lot.
    The day you find that one of DO's solution doesn't work, let us know , it will be a première !

+ 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