Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
dan dan is offline
external usenet poster
 
Posts: 866
Default Highest 3 in 10 Consecutive Numbers

I have a workbook which shows salaries for a number of employees over the
last 10 years. I need to find the average of the three highest consecutive
salaries over that period. The columns are ordered by date so it is not
possible to re-order each row.

2005 2006 2007 2008 Ave
Emp 1 10,000 11,000 12,000 13,000 12,000
Emp 2 13,000 13,000 14,000 10,000 13,333
Emp 3 13,000 12,000 11,000 10,000 12,000

Any help would be grately appreciated!
Dan
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Highest 3 in 10 Consecutive Numbers

Dan,

It's a bit messy but you could do this. Assume your data layout are
2000 2001 2002 2003 2004
Emp 10,000 11,000 12,000 13,000 11,500
Emp 13000 13000 14000 10000 12,500
Emp 13000 12000 11000 10000 11,500

Ive left out 2005 - 2008 because I didn't want it to wrap but the above
table continues to column J for 2008.
Enter this formula in K2 and copy down
=MAX(AVERAGE(B2:D2),AVERAGE(C2:E2),AVERAGE(D2:F2), AVERAGE(F2:H2),AVERAGE(G2:I2),AVERAGE(H2:J2))

Mike

"Dan" wrote:

I have a workbook which shows salaries for a number of employees over the
last 10 years. I need to find the average of the three highest consecutive
salaries over that period. The columns are ordered by date so it is not
possible to re-order each row.

2005 2006 2007 2008 Ave
Emp 1 10,000 11,000 12,000 13,000 12,000
Emp 2 13,000 13,000 14,000 10,000 13,333
Emp 3 13,000 12,000 11,000 10,000 12,000

Any help would be grately appreciated!
Dan

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Highest 3 in 10 Consecutive Numbers

i did of course mean

=MAX(AVERAGE(B2:D2),AVERAGE(C2:E2),AVERAGE(D2:F2), AVERAGE(E2:G2),AVERAGE(F2:H2),AVERAGE(G2:I2),AVERA GE(H2:J2))

"Mike H" wrote:

Dan,

It's a bit messy but you could do this. Assume your data layout are
2000 2001 2002 2003 2004
Emp 10,000 11,000 12,000 13,000 11,500
Emp 13000 13000 14000 10000 12,500
Emp 13000 12000 11000 10000 11,500

Ive left out 2005 - 2008 because I didn't want it to wrap but the above
table continues to column J for 2008.
Enter this formula in K2 and copy down
=MAX(AVERAGE(B2:D2),AVERAGE(C2:E2),AVERAGE(D2:F2), AVERAGE(F2:H2),AVERAGE(G2:I2),AVERAGE(H2:J2))

Mike

"Dan" wrote:

I have a workbook which shows salaries for a number of employees over the
last 10 years. I need to find the average of the three highest consecutive
salaries over that period. The columns are ordered by date so it is not
possible to re-order each row.

2005 2006 2007 2008 Ave
Emp 1 10,000 11,000 12,000 13,000 12,000
Emp 2 13,000 13,000 14,000 10,000 13,333
Emp 3 13,000 12,000 11,000 10,000 12,000

Any help would be grately appreciated!
Dan

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Highest 3 in 10 Consecutive Numbers

Assuming your 10-year span is from Column B to Column K and that the
employee data starts in Row 2, put this formula...

=(LARGE(B2:K2,1)+LARGE(B2:K2,2)+LARGE(B2:K2,3))/3

in L2 and copy down.

Rick


"Dan" wrote in message
...
I have a workbook which shows salaries for a number of employees over the
last 10 years. I need to find the average of the three highest
consecutive
salaries over that period. The columns are ordered by date so it is not
possible to re-order each row.

2005 2006 2007 2008 Ave
Emp 1 10,000 11,000 12,000 13,000 12,000
Emp 2 13,000 13,000 14,000 10,000 13,333
Emp 3 13,000 12,000 11,000 10,000 12,000

Any help would be grately appreciated!
Dan


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 913
Default Highest 3 in 10 Consecutive Numbers

Rick, your formula does not guarantee the three terms to be taken from
three consecutive cells/years.

13,000 12,000 11,000 12,000
should give an average of 12,000 (not 12,333) I guess.

Lars-Åke


On Wed, 26 Mar 2008 05:34:30 -0400, "Rick Rothstein \(MVP - VB\)"
wrote:

Assuming your 10-year span is from Column B to Column K and that the
employee data starts in Row 2, put this formula...

=(LARGE(B2:K2,1)+LARGE(B2:K2,2)+LARGE(B2:K2,3))/3

in L2 and copy down.

Rick


"Dan" wrote in message
...
I have a workbook which shows salaries for a number of employees over the
last 10 years. I need to find the average of the three highest
consecutive
salaries over that period. The columns are ordered by date so it is not
possible to re-order each row.

2005 2006 2007 2008 Ave
Emp 1 10,000 11,000 12,000 13,000 12,000
Emp 2 13,000 13,000 14,000 10,000 13,333
Emp 3 13,000 12,000 11,000 10,000 12,000

Any help would be grately appreciated!
Dan




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Highest 3 in 10 Consecutive Numbers

You obvoiusly didn't like my first answer so how about this one. Same data
layout as before once gain stretcehed out for 10 years

1999 2000 2001 2002 2003 2004
Emp 1000 10,000 11,000 12,000 13,000 99,999
Emp 1026 13000 13000 14000 10000 10000
Emp 1058 13000 12000 11000 10000 10000

Somewhere out of the way enter
=average(B2:D2)
Drag right 7 cells and you have the average for each 3 consecutive years
Then the formula
=Max(the above range)

Give the maximum

Mike


"Lars-Ã…ke Aspelin" wrote:

Rick, your formula does not guarantee the three terms to be taken from
three consecutive cells/years.

13,000 12,000 11,000 12,000
should give an average of 12,000 (not 12,333) I guess.

Lars-Ã…ke


On Wed, 26 Mar 2008 05:34:30 -0400, "Rick Rothstein \(MVP - VB\)"
wrote:

Assuming your 10-year span is from Column B to Column K and that the
employee data starts in Row 2, put this formula...

=(LARGE(B2:K2,1)+LARGE(B2:K2,2)+LARGE(B2:K2,3))/3

in L2 and copy down.

Rick


"Dan" wrote in message
...
I have a workbook which shows salaries for a number of employees over the
last 10 years. I need to find the average of the three highest
consecutive
salaries over that period. The columns are ordered by date so it is not
possible to re-order each row.

2005 2006 2007 2008 Ave
Emp 1 10,000 11,000 12,000 13,000 12,000
Emp 2 13,000 13,000 14,000 10,000 13,333
Emp 3 13,000 12,000 11,000 10,000 12,000

Any help would be grately appreciated!
Dan



  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Highest 3 in 10 Consecutive Numbers

As has been pointed out to me, my formula does not guarantee that the 3
selected years are consecutive. Here is a different formula which I'm pretty
sure does do that...

=SUMPRODUCT(MAX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET(B2: I2,0,2))/3)

Put this formula in L2 (using the same assumptions as to layout as I
previously posted) and copy it down.

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
Assuming your 10-year span is from Column B to Column K and that the
employee data starts in Row 2, put this formula...

=(LARGE(B2:K2,1)+LARGE(B2:K2,2)+LARGE(B2:K2,3))/3

in L2 and copy down.

Rick


"Dan" wrote in message
...
I have a workbook which shows salaries for a number of employees over the
last 10 years. I need to find the average of the three highest
consecutive
salaries over that period. The columns are ordered by date so it is not
possible to re-order each row.

2005 2006 2007 2008 Ave
Emp 1 10,000 11,000 12,000 13,000 12,000
Emp 2 13,000 13,000 14,000 10,000 13,333
Emp 3 13,000 12,000 11,000 10,000 12,000

Any help would be grately appreciated!
Dan



  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Highest 3 in 10 Consecutive Numbers

I missed that the "3 consecutive years" part (I went with what the Subject
said, not what the body of the message said).

Here is the revised formula for this condition that I just posted against my
previous message...

=SUMPRODUCT(MAX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET(B2: I2,0,2))/3)

I am pretty sure this does what the OP asked. And, yes, I know this could
have been posted as an array-entered formula this way...

=MAX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET(B2:I2,0,2))/3

but it seems many people forget about the array-entered formulas'
Ctrl+Shift+Enter commitment keystroke when doing future modifications to
their formulas, so I try to stay away from offering them when possible.

Rick


"Lars-Åke Aspelin" wrote in message
...
Rick, your formula does not guarantee the three terms to be taken from
three consecutive cells/years.

13,000 12,000 11,000 12,000
should give an average of 12,000 (not 12,333) I guess.

Lars-Åke


On Wed, 26 Mar 2008 05:34:30 -0400, "Rick Rothstein \(MVP - VB\)"
wrote:

Assuming your 10-year span is from Column B to Column K and that the
employee data starts in Row 2, put this formula...

=(LARGE(B2:K2,1)+LARGE(B2:K2,2)+LARGE(B2:K2,3) )/3

in L2 and copy down.

Rick


"Dan" wrote in message
...
I have a workbook which shows salaries for a number of employees over the
last 10 years. I need to find the average of the three highest
consecutive
salaries over that period. The columns are ordered by date so it is not
possible to re-order each row.

2005 2006 2007 2008 Ave
Emp 1 10,000 11,000 12,000 13,000 12,000
Emp 2 13,000 13,000 14,000 10,000 13,333
Emp 3 13,000 12,000 11,000 10,000 12,000

Any help would be grately appreciated!
Dan



  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Highest 3 in 10 Consecutive Numbers

Sorry... I forgot to add my thank you for pointing out the mistake in my
first formula... I really do appreciate your having done that as we all want
to (eventually<g) "get it right" for those asking their questions here; so,
again, thank you.

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
I missed that the "3 consecutive years" part (I went with what the Subject
said, not what the body of the message said).

Here is the revised formula for this condition that I just posted against
my previous message...

=SUMPRODUCT(MAX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET(B2: I2,0,2))/3)

I am pretty sure this does what the OP asked. And, yes, I know this could
have been posted as an array-entered formula this way...

=MAX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET(B2:I2,0,2))/3

but it seems many people forget about the array-entered formulas'
Ctrl+Shift+Enter commitment keystroke when doing future modifications to
their formulas, so I try to stay away from offering them when possible.

Rick


"Lars-Åke Aspelin" wrote in message
...
Rick, your formula does not guarantee the three terms to be taken from
three consecutive cells/years.

13,000 12,000 11,000 12,000
should give an average of 12,000 (not 12,333) I guess.

Lars-Åke


On Wed, 26 Mar 2008 05:34:30 -0400, "Rick Rothstein \(MVP - VB\)"
wrote:

Assuming your 10-year span is from Column B to Column K and that the
employee data starts in Row 2, put this formula...

=(LARGE(B2:K2,1)+LARGE(B2:K2,2)+LARGE(B2:K2,3 ))/3

in L2 and copy down.

Rick


"Dan" wrote in message
...
I have a workbook which shows salaries for a number of employees over
the
last 10 years. I need to find the average of the three highest
consecutive
salaries over that period. The columns are ordered by date so it is
not
possible to re-order each row.

2005 2006 2007 2008 Ave
Emp 1 10,000 11,000 12,000 13,000 12,000
Emp 2 13,000 13,000 14,000 10,000 13,333
Emp 3 13,000 12,000 11,000 10,000 12,000

Any help would be grately appreciated!
Dan




  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default Highest 3 in 10 Consecutive Numbers

Hi, Rick

Since the SUMPRODUCT function is only being used to
convert the returned array into "usable" values, it
can be replaced with an INDEX function:

L2: =MAX(INDEX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET(B2:I2,0, 2),0))/3

--------------------------

Best Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)



"Rick Rothstein (MVP - VB)" wrote in
message ...
As has been pointed out to me, my formula does not guarantee that the 3
selected years are consecutive. Here is a different formula which I'm
pretty sure does do that...

=SUMPRODUCT(MAX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET(B2: I2,0,2))/3)

Put this formula in L2 (using the same assumptions as to layout as I
previously posted) and copy it down.

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
Assuming your 10-year span is from Column B to Column K and that the
employee data starts in Row 2, put this formula...

=(LARGE(B2:K2,1)+LARGE(B2:K2,2)+LARGE(B2:K2,3))/3

in L2 and copy down.

Rick


"Dan" wrote in message
...
I have a workbook which shows salaries for a number of employees over the
last 10 years. I need to find the average of the three highest
consecutive
salaries over that period. The columns are ordered by date so it is not
possible to re-order each row.

2005 2006 2007 2008 Ave
Emp 1 10,000 11,000 12,000 13,000 12,000
Emp 2 13,000 13,000 14,000 10,000 13,333
Emp 3 13,000 12,000 11,000 10,000 12,000

Any help would be grately appreciated!
Dan








  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Highest 3 in 10 Consecutive Numbers

First off, my original formula was this array-entered one...

=MAX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET(B2:I2,0,2))/3

I slapped the SUMPRODUCT function around it so the OP wouldn't have to
remember to commit it with Ctrl+Shift+Enter in future editing sessions.

However, being self-taught in all of this, there are gaps in my knowledge
base... the way you are using INDEX seems to be one of them. I'm not exactly
sure why the INDEX formulation you used works. I'm assuming it knows it is
working with an array simply because the summation cannot be interpreted as
a reference. I'm guessing the 0 argument is saying look at this in "entire"
columns, of which there are only one at a time; and I'm guessing the fact
that it interpreted its argument as an array means it will march through
those "entire" columns one at a time (first B2 then C2 then D2, etc.). I
guess the thing that throws me a little is that its argument is a summation
of 3 terms and that it knows how to handle that (I've always assumed the
first argument to the INDEX function had to be a "single" simple entity).
Very interesting stuff... you have given me something new to digest and
internalize. Thanks.

Rick


"Ron Coderre" wrote in message
...
Hi, Rick

Since the SUMPRODUCT function is only being used to
convert the returned array into "usable" values, it
can be replaced with an INDEX function:

L2: =MAX(INDEX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET(B2:I2,0, 2),0))/3

--------------------------

Best Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)



"Rick Rothstein (MVP - VB)" wrote in
message ...
As has been pointed out to me, my formula does not guarantee that the 3
selected years are consecutive. Here is a different formula which I'm
pretty sure does do that...

=SUMPRODUCT(MAX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET(B2: I2,0,2))/3)

Put this formula in L2 (using the same assumptions as to layout as I
previously posted) and copy it down.

Rick


"Rick Rothstein (MVP - VB)" wrote
in
message ...
Assuming your 10-year span is from Column B to Column K and that the
employee data starts in Row 2, put this formula...

=(LARGE(B2:K2,1)+LARGE(B2:K2,2)+LARGE(B2:K2,3))/3

in L2 and copy down.

Rick


"Dan" wrote in message
...
I have a workbook which shows salaries for a number of employees over
the
last 10 years. I need to find the average of the three highest
consecutive
salaries over that period. The columns are ordered by date so it is
not
possible to re-order each row.

2005 2006 2007 2008 Ave
Emp 1 10,000 11,000 12,000 13,000 12,000
Emp 2 13,000 13,000 14,000 10,000 13,333
Emp 3 13,000 12,000 11,000 10,000 12,000

Any help would be grately appreciated!
Dan






  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default Highest 3 in 10 Consecutive Numbers

Rick

However, being self-taught in all of this,

there are gaps in my knowledge base... <<

Don't feel like the Lone Ranger. We're ALL self-taught. It's
exposure to great resources, like this group, that helps us
expand our skill set.

Regarding the use of the INDEX function....When the 2nd argument
is zero (0), it evaluates the first arguement and returns the
array into a series of values that worksheet functions can use
(most of the time).

Quick example:
=MAX({2,4,6,5}+{1,2,3,4}) returns 9

=MAX({2,4,6,5}+COLUMN(A:D)) returns 7 (huh? wrong!)

=MAX(INDEX({2,4,6,5}+COLUMN(A:D),0)) returns 9 (correct)

--------------------------

Best Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"Rick Rothstein (MVP - VB)" wrote in
message ...
First off, my original formula was this array-entered one...

=MAX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET(B2:I2,0,2))/3

I slapped the SUMPRODUCT function around it so the OP wouldn't have to
remember to commit it with Ctrl+Shift+Enter in future editing sessions.

However, being self-taught in all of this, there are gaps in my knowledge
base... the way you are using INDEX seems to be one of them. I'm not
exactly sure why the INDEX formulation you used works. I'm assuming it
knows it is working with an array simply because the summation cannot be
interpreted as a reference. I'm guessing the 0 argument is saying look at
this in "entire" columns, of which there are only one at a time; and I'm
guessing the fact that it interpreted its argument as an array means it
will march through those "entire" columns one at a time (first B2 then C2
then D2, etc.). I guess the thing that throws me a little is that its
argument is a summation of 3 terms and that it knows how to handle that
(I've always assumed the first argument to the INDEX function had to be a
"single" simple entity). Very interesting stuff... you have given me
something new to digest and internalize. Thanks.

Rick


"Ron Coderre" wrote in message
...
Hi, Rick

Since the SUMPRODUCT function is only being used to
convert the returned array into "usable" values, it
can be replaced with an INDEX function:

L2: =MAX(INDEX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET(B2:I2,0, 2),0))/3

--------------------------

Best Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)



"Rick Rothstein (MVP - VB)" wrote
in
message ...
As has been pointed out to me, my formula does not guarantee that the 3
selected years are consecutive. Here is a different formula which I'm
pretty sure does do that...

=SUMPRODUCT(MAX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET(B2: I2,0,2))/3)

Put this formula in L2 (using the same assumptions as to layout as I
previously posted) and copy it down.

Rick


"Rick Rothstein (MVP - VB)" wrote
in
message ...
Assuming your 10-year span is from Column B to Column K and that the
employee data starts in Row 2, put this formula...

=(LARGE(B2:K2,1)+LARGE(B2:K2,2)+LARGE(B2:K2,3))/3

in L2 and copy down.

Rick


"Dan" wrote in message
...
I have a workbook which shows salaries for a number of employees over
the
last 10 years. I need to find the average of the three highest
consecutive
salaries over that period. The columns are ordered by date so it is
not
possible to re-order each row.

2005 2006 2007 2008 Ave
Emp 1 10,000 11,000 12,000 13,000 12,000
Emp 2 13,000 13,000 14,000 10,000 13,333
Emp 3 13,000 12,000 11,000 10,000 12,000

Any help would be grately appreciated!
Dan









  #13   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Highest 3 in 10 Consecutive Numbers

See inline...

However, being self-taught in all of this,

there are gaps in my knowledge base... <<

Don't feel like the Lone Ranger. We're ALL self-taught.


Yeah, but I'm guessing you and the other regulars here have been self-taught
longer than me.<g

It's exposure to great resources, like this group, that helps us
expand our skill set.


No question about that... I have learned a lot over this past year of my
volunteering in this newsgroup by just reading the various posted answers
here.

Regarding the use of the INDEX function....When the 2nd argument
is zero (0), it evaluates the first arguement and returns the
array into a series of values that worksheet functions can use
(most of the time).

Quick example:
=MAX({2,4,6,5}+{1,2,3,4}) returns 9

=MAX({2,4,6,5}+COLUMN(A:D)) returns 7 (huh? wrong!)

=MAX(INDEX({2,4,6,5}+COLUMN(A:D),0)) returns 9 (correct)


That second formula really is a "huh", isn't it? If you highlight
COLUMN(A:D) and press F9, it shows the expansion as {1,2,3,4} as one would
expect. If you highlight {2,4,6,5}+COLUMN(A:D) which is the argument to the
MAX function, and press F9, it shows the expansion as {3,6,9,9}, again, as
would be expected. But then, instead of MAX choosing one of the values from
{3,6,9,9}, it goes and makes up a value of 7?!!? While the F9 expansions
show the array values correctly, the MAX function appears to be ignoring the
array evaluations of COLUMN(A:D) and simply using the first value in the
array list, 1, and adding it to the first array's values before selecting
the maximum value of 7 (6+1). If you change your formula to use COLUMN(B:E)
instead, the formula will return 8 which appears to be the 6 from the first
array grouping plus the 2 (B's equivalent as a column number) from the array
expansion of COLUMN(B:E). The mechanism at work here seems to be akin to the
one at work in a formula like this...

=FIND({"a","b"},<<SomeText)

When <<SomeText is the word "about", the formula works and returns 1; but,
when <<SomeText is the word "bout", the formula errors out... and it does
that whether you array-enter it or not. Some functions seem able to tolerate
an array without actually being able to use anything past its first
argument... this appears to be the case with your second formula.

Rick

  #14   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default Highest 3 in 10 Consecutive Numbers

"Ron Coderre" wrote...
Since the SUMPRODUCT function is only being used to
convert the returned array into "usable" values, it
can be replaced with an INDEX function:

L2: =MAX(INDEX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET(B2:I2,0, 2),0))/3

....
"Rick Rothstein (MVP - VB)" wrote...

....
=SUMPRODUCT(MAX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET(B 2:I2,0,2))/3)

....

Or avoid using the volatile OFFSET call completely while also
simplifying:

=MAX(B2:I2+C2:J2+D2:K2)/3

which needs to be entered as an array formula, or

=MAX(INDEX(B2:I2+C2:J2+D2:K2,0))/3

which avoids array entry.

Going the opposite direction, to generalize this to the average of the
N largest consecutive values, you'd need to use something like the
following array formula

=MAX(MMULT(TRANSPOSE(COLUMN(B2:K2)-MIN(COLUMN(B2:K2))
<=COLUMNS(B2:K2)-$N$1)*(ABS(COLUMN(B2:K2)-TRANSPOSE(COLUMN(B2:K2))
-($N$1-1)/2)<$N$1/2),TRANSPOSE(B2:K2)))/$N$1
  #15   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Highest 3 in 10 Consecutive Numbers

I just keep learning more and more. Thanks Harlan, much appreciated!

Rick


"Harlan Grove" wrote in message
...
"Ron Coderre" wrote...
Since the SUMPRODUCT function is only being used to
convert the returned array into "usable" values, it
can be replaced with an INDEX function:

L2: =MAX(INDEX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET(B2:I2,0, 2),0))/3

...
"Rick Rothstein (MVP - VB)" wrote...

...
=SUMPRODUCT(MAX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET( B2:I2,0,2))/3)

...

Or avoid using the volatile OFFSET call completely while also
simplifying:

=MAX(B2:I2+C2:J2+D2:K2)/3

which needs to be entered as an array formula, or

=MAX(INDEX(B2:I2+C2:J2+D2:K2,0))/3

which avoids array entry.

Going the opposite direction, to generalize this to the average of the
N largest consecutive values, you'd need to use something like the
following array formula

=MAX(MMULT(TRANSPOSE(COLUMN(B2:K2)-MIN(COLUMN(B2:K2))
<=COLUMNS(B2:K2)-$N$1)*(ABS(COLUMN(B2:K2)-TRANSPOSE(COLUMN(B2:K2))
-($N$1-1)/2)<$N$1/2),TRANSPOSE(B2:K2)))/$N$1




  #16   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default Highest 3 in 10 Consecutive Numbers

Good points, Harlan.
Since there are only 3 consecutive values to average,
there's no real gain from using the OFFSET functions.

Array Formulas:
I like them, but they're too fragile
for the relatively inexperienced users I work with.

Interesting MMULT formula. I'll have to study it a bit, though.

Best Regards,

Ron



"Harlan Grove" wrote in message
...
"Ron Coderre" wrote...
Since the SUMPRODUCT function is only being used to
convert the returned array into "usable" values, it
can be replaced with an INDEX function:

L2: =MAX(INDEX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET(B2:I2,0, 2),0))/3

...
"Rick Rothstein (MVP - VB)" wrote...

...
=SUMPRODUCT(MAX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET( B2:I2,0,2))/3)

...

Or avoid using the volatile OFFSET call completely while also
simplifying:

=MAX(B2:I2+C2:J2+D2:K2)/3

which needs to be entered as an array formula, or

=MAX(INDEX(B2:I2+C2:J2+D2:K2,0))/3

which avoids array entry.

Going the opposite direction, to generalize this to the average of the
N largest consecutive values, you'd need to use something like the
following array formula

=MAX(MMULT(TRANSPOSE(COLUMN(B2:K2)-MIN(COLUMN(B2:K2))
<=COLUMNS(B2:K2)-$N$1)*(ABS(COLUMN(B2:K2)-TRANSPOSE(COLUMN(B2:K2))
-($N$1-1)/2)<$N$1/2),TRANSPOSE(B2:K2)))/$N$1



  #17   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 913
Default Highest 3 in 10 Consecutive Numbers

On Wed, 26 Mar 2008 12:32:54 -0700 (PDT), Harlan Grove
wrote:

"Ron Coderre" wrote...
Since the SUMPRODUCT function is only being used to
convert the returned array into "usable" values, it
can be replaced with an INDEX function:

L2: =MAX(INDEX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET(B2:I2,0, 2),0))/3

...
"Rick Rothstein (MVP - VB)" wrote...

...
=SUMPRODUCT(MAX(B2:I2+OFFSET(B2:I2,0,1)+OFFSET( B2:I2,0,2))/3)

...

Or avoid using the volatile OFFSET call completely while also
simplifying:

=MAX(B2:I2+C2:J2+D2:K2)/3

which needs to be entered as an array formula, or

=MAX(INDEX(B2:I2+C2:J2+D2:K2,0))/3

which avoids array entry.

Going the opposite direction, to generalize this to the average of the
N largest consecutive values, you'd need to use something like the
following array formula

=MAX(MMULT(TRANSPOSE(COLUMN(B2:K2)-MIN(COLUMN(B2:K2))
<=COLUMNS(B2:K2)-$N$1)*(ABS(COLUMN(B2:K2)-TRANSPOSE(COLUMN(B2:K2))
-($N$1-1)/2)<$N$1/2),TRANSPOSE(B2:K2)))/$N$1



This was an elegant solution indeed, but it is limited to results that
are non negative. That is probably OK for the original poster as
salaries should be non negative numbers, but it does not work in the
general case where the input, the 10 numbers, could be negative as
well as positive.

  #18   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default Highest 3 in 10 Consecutive Numbers

Lars-Åke Aspelin wrote...
Harlan Grove wrote...

...
=MAX(MMULT(TRANSPOSE(COLUMN(B2:K2)-MIN(COLUMN(B2:K2))
<=COLUMNS(B2:K2)-$N$1)*(ABS(COLUMN(B2:K2)-TRANSPOSE(COLUMN(B2:K2))
-($N$1-1)/2)<$N$1/2),TRANSPOSE(B2:K2)))/$N$1


This was an elegant solution indeed, but it is limited to results
that are non negative. That is probably OK for the original poster
as salaries should be non negative numbers, but it does not work in
the general case where the input, the 10 numbers, could be negative
as well as positive.


An opportunity for me to shorten the formula too.

=MAX(IF(COLUMN(B2:K2)-MIN(COLUMN(B2:K2))<=COLUMNS(B2:K2)-$N$1,
MMULT(B2:K2,--(ABS(TRANSPOSE(COLUMN(B2:K2))-COLUMN(B2:K2)-($N$1-1)/2)
<$N$1/2))))/$N$1
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Highest 3 in 10 Based on Consecutive Cells Dan Excel Discussion (Misc queries) 2 March 25th 08 07:28 PM
How do I find the 12 highest numbers in a row of 52 numbers Johnny Excel Worksheet Functions 3 July 8th 06 11:58 PM
Sum 3 highest numbers Molly Excel Worksheet Functions 5 May 3rd 06 06:08 AM
Help! How do you get excel to find the x(changes daily, marked in a cell from another formula) highest numbers in a group of numbers and sum them up? C-Man23 Excel Worksheet Functions 3 January 19th 06 09:52 AM
Help! How do you get excel to find the x(changes daily, marked in a cell from another formula) highest numbers in a group of numbers and sum them up? C-Man23 Excel Worksheet Functions 1 January 9th 06 01:23 PM


All times are GMT +1. The time now is 05:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"