+ Reply to Thread
Results 1 to 6 of 6

Dynamically average first 4 non blank cells in a column

  1. #1
    Registered User
    Join Date
    08-11-2013
    Location
    Scotland
    MS-Off Ver
    Microsoft 365 v2111
    Posts
    4

    Dynamically average first 4 non blank cells in a column

    Hi,

    I have 8 columns of retailer data - in columns C-J
    Data starts at Row 2 for 6 out of the 8 retailers but at row 25 for retailer 2 (column D) and row 5 for retailer 7 (Column I)
    In Row 2 of columns P-W I would like to set a baseline for each retailer and show the average of the first 4 weeks of data, taking the starting point as their first row that isn't blank
    For 6 columns it would be an average of rows 2-5, for column D it would be rows 25-28 and Column I it would be rows 5-8

    There should only be up to 52 rows of data for each table but the number of columns could vary (the baseline will be on another sheet, but I have put it in P-W for examples sake).

    I'd like it dynamic because although this is just a small table, it could be repeated very often with different columns starting at different points so manually adjusting it would take a lot of time and be fiddly / prone to error.

    Apologies if this has been answered before - I have looked around the forum and can't see anything that fits, but I might be missing something.

    Thanks in advance.

  2. #2
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Dynamically average first 4 non blank cells in a column

    Not elegant and entered as an array with shift control enter
    =AVERAGE(OFFSET(C$2,0,0,SMALL(IF(C$2:C$52<>"",ROW($C$1:$C$51)),4),1))

    you find the row of the 4th non blank value and then find the average of this all all the preceding rows (blanks are not calculated as part of the average function

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,771

    Re: Dynamically average first 4 non blank cells in a column

    Administrative Note:

    Members will tailor the solutions they offer to the version of Office (Excel) that you have. Please check that your forum profile is up-to-date in this respect. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. If your version is for Mac, please also state this. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  4. #4
    Registered User
    Join Date
    08-11-2013
    Location
    Scotland
    MS-Off Ver
    Microsoft 365 v2111
    Posts
    4

    Re: Dynamically average first 4 non blank cells in a column

    Well, you may think it is inelegant, but it works so it's great in my book. Thanks very much!

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,771

    Re: Dynamically average first 4 non blank cells in a column

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of all those who offered help.

  6. #6
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    China Shanghai
    MS-Off Ver
    365 V2503 and WPS V2024(12.1.0.18543)
    Posts
    3,920

    Re: Dynamically average first 4 non blank cells in a column

    Cell P2 formula , Drag right

    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ 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. average last 3 cells in a column that are not blank
    By hawkdaddy404 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-10-2020, 06:48 PM
  2. how to average a value in blank cells in a column between cells with data
    By mitomke in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-25-2019, 10:50 AM
  3. [SOLVED] Auto Average Cells on Either Side of Blank in Column
    By jmjohnston in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-31-2018, 07:34 PM
  4. How to Get the Average of First 5 Non-Blank Cells in a Column?
    By southerk in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-24-2014, 10:01 PM
  5. Average the last 10 cells of a dynamic column but ignore blank cells & 0
    By mattadler22 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-13-2013, 11:37 PM
  6. [SOLVED] find blank cells in column and average the cells below
    By desibabuji in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-03-2013, 12:03 PM
  7. Average of next 6 non blank cells in a column.
    By hackboy in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-15-2012, 10:44 AM

Tags for this Thread

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