+ Reply to Thread
Results 1 to 9 of 9

Average of the last 3 numbered cells

Hybrid View

Rikuk Average of the last 3... 08-05-2008, 10:44 AM
NBVC One way... ... 08-05-2008, 10:57 AM
Rikuk Thanks works a treat 08-05-2008, 11:09 AM
ChemistB I prefer the OFFSET function... 08-05-2008, 11:29 AM
Ron Coderre OFFSET is volatile 08-05-2008, 11:37 AM
Ron Coderre Average of the last 3... 08-05-2008, 11:08 AM
NBVC oOOPS. Don't know why I... 08-05-2008, 11:20 AM
  1. #1
    Registered User
    Join Date
    08-23-2005
    Posts
    53

    Average of the last 3 numbered cells

    Hi,
    Could anyone help please I have a grid example below, I need to know the average for the last 3 numbered cells in each row? which will change weekly

    Week 1 Week 2 Week 3 Week 4 Week 5 Week 6
    A 157 621 142 458
    B 150 155 90
    C 456 568 584 452

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

    =AVERAGE(INDEX(A1:Z1,MATCH(9.9999999E+307,A1:Z1)),INDEX(A1:Z1,MATCH(9.9999999E+307,A1:Z1)-1),INDEX(A1:Z1,MATCH(9.9999999E+307,A1:Z1)-2))
    where A1:Z1 is your first row range... you can replace with 1:1 if you want to include entire row.

    formula can be copied down.
    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
    08-23-2005
    Posts
    53
    Thanks works a treat

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    I prefer the OFFSET function
    =AVERAGE(OFFSET(A2,,COUNT(2:2)-3,,3))
    ChemistB

  5. #5
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    OFFSET is volatile

    Quote Originally Posted by ChemistB
    I prefer the OFFSET function
    =AVERAGE(OFFSET(A2,,COUNT(2:2)-3,,3))
    ChemistB
    That's a possibility...with the following caveat:
    The OFFSET function is volatile, so every cell containing OFFSET recalculates
    whenever *any* cell in the workbook recalcs. There is a threshhold where
    the workbook becomes annoyingly sluggish. Consequently, I only use
    OFFSET sparingly and only when necessary.

    This is my latest list of volatile functions:
    RAND, NOW, TODAY, OFFSET, CELL, INDIRECT
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    Thanks Ron, I will definitely remember that when working with Offset in the future. Question: What if Offset is used in a defined name? Does it have the same problem?

    Thanks

    ChemistB

  7. #7
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Average of the last 3 numbered cells

    With your posted data in A1:G4

    This formula returns the average of the last 3 consecutive values in B2:G2:
    H2: =AVERAGE(INDEX(B2:G2,MATCH(10^99,B2:G2)):INDEX(B2:G2,MATCH(10^99,B2:G2)-2))
    Is that something you can work with?

  8. #8
    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 Ron Coderre
    With your posted data in A1:G4

    This formula returns the average of the last 3 consecutive values in B2:G2:
    H2: =AVERAGE(INDEX(B2:G2,MATCH(10^99,B2:G2)):INDEX(B2:G2,MATCH(10^99,B2:G2)-2))
    Is that something you can work with?

    oOOPS.

    Don't know why I didn't think of using a range instead of 3 arguments...

    Mine would then be:

    =AVERAGE(INDEX(A1:Z1,MATCH(9.9999999E+307,A1:Z1)-2):INDEX(A1:Z1,MATCH(9.9999999E+307,A1:Z1)))

+ 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