+ Reply to Thread
Results 1 to 3 of 3

Trying to average based on a condition and treat blanks as 0

  1. #1
    Registered User
    Join Date
    06-25-2012
    Location
    Melbourne
    MS-Off Ver
    Excel 2007
    Posts
    22

    Trying to average based on a condition and treat blanks as 0

    Hi,

    I have a worksheet where row 1 contains headings.
    Rows 2 to 999 have data.
    For each row, columns E to X contain a single numeric rating, 0 through to 5. However, commonly blank is used instead of 0.

    In column Z I want to provide the average of the columns E to X for each row.

    However, I must include blanks and treat them as 0.
    and I only want to include columns where the heading (row 1) is not "?"
    and if column B for the row is blank, forget the average and show blank

    I know this will produce the average of the columns E to X without "?" as a heading:
    =IF($B2="","",AVERAGEIF(E$1:X$1,"<>?",E2:X2))

    However, it will give a #DIV/0! for any blanks

    I know this will produce the average of columns E to X treating BLANK as 0:
    =IF($B2="","",AVERAGE(IF(ISNUMBER(E2:X2),E2:X2,IF(E2:X2="",0))))

    However, it will include ALL columns regardless of the value in row 1.


    How can I combine these, please?

    Thanks

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Trying to average based on a condition and treat blanks as 0

    Try:

    =IF($B2="","",AVERAGE(IF(E$1:X$1<>"?",E2:X2)))

    confirmed with CTRL+SHIFT+ENTER
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    06-25-2012
    Location
    Melbourne
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Trying to average based on a condition and treat blanks as 0

    Thank you - that worked perfectly!

    Quote Originally Posted by NBVC View Post
    Try:

    =IF($B2="","",AVERAGE(IF(E$1:X$1<>"?",E2:X2)))

    confirmed with CTRL+SHIFT+ENTER

+ 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