+ Reply to Thread
Results 1 to 5 of 5

Help with AVERAGE

  1. #1
    Registered User
    Join Date
    12-03-2016
    Location
    Michigan
    MS-Off Ver
    2010
    Posts
    3

    Help with AVERAGE

    I have a sales spreadsheet that has dates in rows and sales locations and income in columns. I want to get an average of a given location only for weeks where sales are reported. But I want the formula to be such that as I add weeks I don't have to change the formula. I have attached a sample sheet.

    In the sample, I want B2 to be average of D2 through AA2 but only for columns in which row 1 has a date in it. I don't want to include weeks for which nothing has been collected yet (such as O2). I want the blank columns (e.g., D2, G2, H2, etc.) to be included as $0.00 in the average because those are weeks in which the money is coming in but not yet collected; I collect money every other week in most locations so the numbers are actually two-week numbers and I want a weekly average.

    For instance, as of now, B2 should be an average of D2:N2 (which is $21.73). Next week, when I add the sales for 12/5/16, I want to automatically include that column in average of B2.

    It seems like it should be something along the lines of this though I can't figure out the syntax: B2 =AVERAGEIF(D1:AA1,"*",D2:AA2) but that gives a #DIV/0! error.

    An alternative would be to use C2 (which the total of the row 2) divided by the number of columns in row 1 that have a date in them.

    Any ideas on the best way to do this?

    Thanks for any help.
    Attached Files Attached Files

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Help with AVERAGE

    This array formula** entered in B2 and copied down:

    =AVERAGE(IF(D$1:AA$1<>"",D2:AA2))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    12-03-2016
    Location
    Michigan
    MS-Off Ver
    2010
    Posts
    3

    Re: Help with AVERAGE

    Thanks for that.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Help with AVERAGE

    You're welcome!

  5. #5
    Forum Contributor
    Join Date
    02-07-2013
    Location
    Karachi, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    290

    Re: Help with AVERAGE

    Hi,
    Although you've got solution, adding just another (non array)

    =SUM(D2:N2)/COUNTIF(D2:N2,"<>0")

    Blessing
    Khalid

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. SumProduct N/A Error, Quarterly Average, Running Average, From and to Userform
    By Sorjas in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-18-2015, 07:40 PM
  2. [SOLVED] Find Average, Return Column Header of Number Closest To Average
    By djmyers in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 07-07-2013, 04:19 PM
  3. Replies: 14
    Last Post: 06-14-2013, 09:00 PM
  4. Replies: 10
    Last Post: 04-25-2013, 06:12 PM
  5. displaying numbers whoes average is as close prefered average.
    By aakhan107 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-18-2012, 01:14 AM
  6. The rank of average ranks excluding empty cells but including their average.
    By Terminal45 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-21-2012, 03:44 AM
  7. Replies: 5
    Last Post: 06-19-2012, 04:37 PM

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