P Picman Nov 11, 2008 #1 i want to always calculate the average of the bottom 5 rows of a longer list even after a new row is inserted and the list is resorted.
i want to always calculate the average of the bottom 5 rows of a longer list even after a new row is inserted and the list is resorted.
S ShaneDevenshire Nov 11, 2008 #3 Hi, In 2003 and earlier you could use this =SUMPRODUCT(SUM(OFFSET(A1,LARGE(ROW(A1:A20)*(A1:A20<>""),{1,2,3,4,5})-1,)))/5 In 2007 this fails.
Hi, In 2003 and earlier you could use this =SUMPRODUCT(SUM(OFFSET(A1,LARGE(ROW(A1:A20)*(A1:A20<>""),{1,2,3,4,5})-1,)))/5 In 2007 this fails.
S ShaneDevenshire Nov 11, 2008 #4 Hi, Back again with a 2007 solution: =AVERAGE(INDIRECT("A"&MAX((A1:A21<>"")*ROW(A1:A21))-4&":A"&MAX((A1:A21<>"")*ROW(A1:A21)))) This formula must be array entered - press Shift+Ctrl+Enter to enter it.
Hi, Back again with a 2007 solution: =AVERAGE(INDIRECT("A"&MAX((A1:A21<>"")*ROW(A1:A21))-4&":A"&MAX((A1:A21<>"")*ROW(A1:A21)))) This formula must be array entered - press Shift+Ctrl+Enter to enter it.
T Teethless mama Nov 11, 2008 #5 It's not an elegant formula: =SUMPRODUCT(SUM(OFFSET(A1,LARGE(ROW(A1:A20)*(A1:A20<>""),{1,2,3,4,5})-1,)))/5 Click to expand... Here is an elegant solution, but also works for XL-2007 =SUM(OFFSET(INDIRECT("A"&ROWS(A1:A20)),,,-5))/5
It's not an elegant formula: =SUMPRODUCT(SUM(OFFSET(A1,LARGE(ROW(A1:A20)*(A1:A20<>""),{1,2,3,4,5})-1,)))/5 Click to expand... Here is an elegant solution, but also works for XL-2007 =SUM(OFFSET(INDIRECT("A"&ROWS(A1:A20)),,,-5))/5
T T. Valko Nov 11, 2008 #6 =SUMPRODUCT(SUM(OFFSET(A1 said: In 2007 this fails. Click to expand... Very interesting. I wonder why? It should. In 2007 the SUM function isn't accepting the results of OFFSET but it does in Excel 2002 (my other version). This works in 2007: =SUMPRODUCT(N(OFFSET(A1,LARGE(ROW(A1:A21)*(A1:A21<>""),{1,2,3,4,5})-1,)))/5 I'm going to post this in the private ng.
=SUMPRODUCT(SUM(OFFSET(A1 said: In 2007 this fails. Click to expand... Very interesting. I wonder why? It should. In 2007 the SUM function isn't accepting the results of OFFSET but it does in Excel 2002 (my other version). This works in 2007: =SUMPRODUCT(N(OFFSET(A1,LARGE(ROW(A1:A21)*(A1:A21<>""),{1,2,3,4,5})-1,)))/5 I'm going to post this in the private ng.
P Picman Nov 11, 2008 #8 This didn't work. it didn't even return the correct result before adding a row.
P Picman Nov 11, 2008 #9 That worked like a charm, thank you. ShaneDevenshire said: Hi, In 2003 and earlier you could use this =SUMPRODUCT(SUM(OFFSET(A1,LARGE(ROW(A1:A20)*(A1:A20<>""),{1,2,3,4,5})-1,)))/5 In 2007 this fails. Click to expand...
That worked like a charm, thank you. ShaneDevenshire said: Hi, In 2003 and earlier you could use this =SUMPRODUCT(SUM(OFFSET(A1,LARGE(ROW(A1:A20)*(A1:A20<>""),{1,2,3,4,5})-1,)))/5 In 2007 this fails. Click to expand...