+ Reply to Thread
Results 1 to 5 of 5

Calculate Average Using Date Range

  1. #1
    Registered User
    Join Date
    04-06-2008
    Location
    Birmingham
    Posts
    25

    Calculate Average Using Date Range

    Can anyone possibly help with the following please:

    I have a spreadsheet that contains the month in column A. Column B contains a list of numbers, but there are blanks in some of the fields in Column B. Basically I want to calculate the average of the numbers in Column B for each month shown in Column A.

    See example data below. Can anyone help with a formula that can calculate average but exclude/ignore any blank fields in the number Field.


    Month Number
    May 2
    June 3
    May
    June 4
    June 7
    June 9
    June
    June 12

    Can anyone help?

    Any help would be greatly appreciated.

    Many Thanks

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

    =Average(IF(A1:A100="June",IF(B1:B100<>"",B1:B100))

    adjust ranges to suit

    This formula must be confirmed with CTRL+SHIFT+ENTER not just ENTER. You will see { } brackets appear.
    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
    04-06-2008
    Location
    Birmingham
    Posts
    25
    Thank you so much for this NBVC this works a treat!

  4. #4
    Registered User
    Join Date
    07-02-2008
    Location
    Winnipeg, MB
    Posts
    57
    Quote Originally Posted by NBVC
    For example...

    =Average(IF(A1:A100="June",IF(B1:B100<>"",B1:B100))

    adjust ranges to suit

    This formula must be confirmed with CTRL+SHIFT+ENTER not just ENTER. You will see { } brackets appear.
    I am trying to better understand excel formulas in general and I was wondering what the "(B1:B100<>"",B1:B100)" part of this formula means?

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by Vbort44
    I am trying to better understand excel formulas in general and I was wondering what the "(B1:B100<>"",B1:B100)" part of this formula means?
    This formula is simply an array version of a regular IF statement...

    So if this was a regular "check one cell statement", it might look something like:

    =IF(A1="June",IF(B1<>"",B1))

    which would say if A1 = "June" and if B1 is not blank, then return what's in B1.

    The array version looks at all elements in the array(s) and tests each one and returns an array of results (stored internally)...

    so =IF(A1:A100="June",IF(B1:B100<>"",B1:B100)) would create an internal array of all elements from B1:B100 where you have "June" in range A1:A100 and corresponding elements in B1:B100 are not blank.

    The AVERAGE() function then averages only those elements returned as TRUE

    Here's more on Array formulas: http://www.cpearson.com/excel/ArrayFormulas.aspx

+ 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