View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Help with a function

On Fri, 20 Jan 2006 22:31:16 -0500, "Bri" wrote:

Hello. I'm quite new to excel VBA and could really use help with a
function. Here's the situation.

When judging dance competitions, there are up to 5 judges. Their scores are
listed in adjacent columns. I need to call a function in the next column
that computes the average score subject to some conditions.
a) If there are 5 or 4 judges, the high and low scores are dropped and the
average of the remaining scores is used. (Scores may have up to three
decimal places, eg 9.115)
b) If there are 1, 2 or 3 judges, no scores are dropped when finding the
average
c) When a judge is missing from the panel, the cell is left blank.(not to be
confused with a judged score of 0.000)
d) The final score is rounded DOWN to three decimal places, so that 7.13583
becomes 7.135, not 7.136 as you might expect.

I've got a competition coming up soon, so I hope someone can help!

Thanks in advance
Bri


The following **array** formula should do what you specify.

=ROUNDDOWN(AVERAGE(LARGE(Scores,
ROW(INDIRECT(1+(COUNT(Scores)3)&":"&
MIN(COUNT(Scores),3)+(COUNT(Scores)=5))))),3)

"Scores" is the five cell range where your judges scores are potentially
entered.

To enter an **array** formula, after copying or typing it into the cell, hold
down <ctrl<shift while hitting <enter. Excel will place braces {...} around
the formula.

I note from your specifications that with four judges, you only use two scores;
but with three judges, you use three scores. Is this correct?


--ron