+ Reply to Thread
Results 1 to 11 of 11

Average every 5th non-empty/blank column

  1. #1
    Registered User
    Join Date
    08-11-2014
    Location
    Australia
    MS-Off Ver
    Microsoft Office 2013
    Posts
    9

    Average every 5th non-empty/blank column

    Hi,

    I have a dataset where I need to average every 5th column. However, I have missing values in some columns, which disrupts the average when using the normal formula method to look at every nth row:

    (=AVERAGE(IF(MOD(COLUMN($A$1:$O$1),2)=0,$A$1:$O$1,0))

    I would like the formula to only take a cell into account if it has a non-zero value, and is therefore non-empty. Can anyone help with this please?

    Cheers.

  2. #2
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Average every 5th non-empty/blank column

    maybe.

    =AVERAGE(IF(($A$1:$O$1<>"")*(MOD(COLUMN($A$1:$O$1),2)=1), $A$1:$O$1,0))


    ***Not tested
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Average every 5th non-empty/blank column

    If the cell is EMPTY, use this:

    =AVERAGE(OFFSET($A$1:$O$1,(COLUMNS($A:A)-1)*5,))
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Average every 5th non-empty/blank column

    Ooops. here's a file...
    Attached Files Attached Files

  5. #5
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Average every 5th non-empty/blank column

    Pls attach sample excel file with expected result
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Average every 5th non-empty/blank column

    I'm not awake yet, it seems. Disregard the alst file. The formula was OK, but the example wasn't.

    If the cells are EMPTY, use this ordinary formula:
    =AVERAGE(OFFSET($A$1:$O$1,(COLUMNS($A:A)-1)*5,))

    If the cells actually contain a zero, use this arry formula:
    =AVERAGE(IF(MOD(COLUMN(A1:O1)-COLUMN(A1),5)=0,IF(A1:O1>0,A1:O1)))


    Array Formulae are a little different from ordinary formulas in that they MUST be confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.

    You will know the array is active when you see curly braces { } appear around the outside of your formula. If you do not CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly braces yourself - it won't work...
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    08-11-2014
    Location
    Australia
    MS-Off Ver
    Microsoft Office 2013
    Posts
    9

    Re: Average every 5th non-empty/blank column

    Hi Glenn,

    Thanks for your quick reply! Yep that's almost there, but the formula you used does not exclude values inputted into the 2nd, 3rd, 4th and 5th columns. I've attached any example of how I have done this previously, but now that I have so much data, simply clicking each cell was way too time consuming.

    To give this better context, I want to find the average and standard deviation of 5 different variables across a number of time points, which are delivered horizontally using a pivot table. Please see the attached example.

    Thanks again!
    Attached Files Attached Files

  8. #8
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Average every 5th non-empty/blank column

    I see this 2 different ways.
    1. The values to be averaged are in B3, G3 AND L3
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    2. The values to be averaged are in F3, K3 AND P3
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    BOTH FORMULAE ARE ARRAY FORMULAE. ENTER WITH CTRL + SHIFT + ENTER

    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    N
    O
    P
    1
    Day 1
    Day 2
    Day 3
    2
    Var1
    Var2
    Var3
    Var4
    Var5
    Var1
    Var2
    Var3
    Var4
    Var5
    Var1
    Var2
    Var3
    Var4
    Var5
    3
    Name:
    1
    2
    3
    4
    5
    1.2
    2.3
    3.2
    4.1
    5.6
    1.1
    2.4
    3.3
    4.3
    5.6
    4
    5
    1
    1.1
    6
    2
    5.4
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  9. #9
    Registered User
    Join Date
    08-11-2014
    Location
    Australia
    MS-Off Ver
    Microsoft Office 2013
    Posts
    9

    Re: Average every 5th non-empty/blank column

    Thanks for that! We are almost there, I apologize but I forgot to include that there will be some missing values in some of the cells (i.e. no data entry on a particular time point). Please see new example attached.
    Attached Files Attached Files

  10. #10
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Average every 5th non-empty/blank column

    Perhaps this is what you are looking for.
    For the Average, enter this in S3 and fill across.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    For the STDEV enter this in X3 and fill across.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Both formulae are ARRAY formulae so enter with Ctrl + Shift + Enter

    S
    T
    U
    V
    W
    X
    Y
    Z
    AA
    AB
    1
    Average
    StDev
    2
    Ave1
    Av2
    Ave3
    Ave4
    Ave5
    Stdev1
    Stdev2
    Stdev3
    Stdev4
    Stdev5
    3
    1.1
    2.2
    3.2
    4.3
    5.4
    0.1
    0.2
    0.2
    0.4
    0.3

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Average every 5th non-empty/blank column

    Yea - that's it. NDM's formula is spot on, but the displayed values for Var 4 (4.3 and 0.4) aren't correct. The formula does, however, give the correct answers (4.1 & 0.2).

+ 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. Replies: 2
    Last Post: 11-04-2014, 10:30 AM
  2. 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
  3. How to prevent row/column counts from counting empty/blank rows?
    By reach78 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-17-2013, 01:38 AM
  4. blank if the column is empty
    By zafirah in forum Excel General
    Replies: 0
    Last Post: 08-17-2013, 09:02 PM
  5. Average Numbers in Column Until Blank Cell
    By chouston in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-26-2013, 07:34 PM
  6. 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
  7. Replies: 15
    Last Post: 03-16-2012, 07:45 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