I need to find the median 3 values in a range, which will be added together.
I will have either 3, 5, or 7 values in the range. If I have 3 values, I just
need to add them; with 5 values, I need to throw out the high and low values;
and with 7 values, I need to throw out the 2 high and 2 low values.
For example:
Range: 3, 5, 5, 6, 4 Result: 5+5+4 (throw out 3 and 6)
Range: 5, 7, 6, 5, 7, 7, 6 Result: 7+6+6 (throw out both 5s and two of the
7s)
Can anyone help with this?
Thanks,
~ Horatio
Bob Umlas, Excel MVP - 19 Nov 2007 15:51 GMT
=sum(range)-choose((count(range)-1)/2,0,min(range)+max(range),small(range,1)+small(range,2)+large(range,1)+large(range,2))
> I need to find the median 3 values in a range, which will be added together.
> I will have either 3, 5, or 7 values in the range. If I have 3 values, I just
[quoted text clipped - 9 lines]
> Thanks,
> ~ Horatio
Horatio J. Bilge, Jr. - 19 Nov 2007 16:56 GMT
That worked great. Thanks.
> =sum(range)-choose((count(range)-1)/2,0,min(range)+max(range),small(range,1)+small(range,2)+large(range,1)+large(range,2))
>
[quoted text clipped - 11 lines]
> > Thanks,
> > ~ Horatio
Ron Rosenfeld - 19 Nov 2007 18:26 GMT
>I need to find the median 3 values in a range, which will be added together.
>I will have either 3, 5, or 7 values in the range. If I have 3 values, I just
[quoted text clipped - 9 lines]
>Thanks,
>~ Horatio
=SUMPRODUCT(LARGE(rng,ROW(INDIRECT(1+INT((COUNT(rng)-1)/3)&":"&COUNT(rng)-INT((COUNT(rng)-1)/3)))))
--ron
T. Valko - 19 Nov 2007 19:52 GMT
Assuming there is always only 3, 5 or 7 numbers:
=TRIMMEAN(rng,(COUNT(rng)-3)/COUNT(rng))*3

Signature
Biff
Microsoft Excel MVP
>I need to find the median 3 values in a range, which will be added
>together.
[quoted text clipped - 13 lines]
> Thanks,
> ~ Horatio
Horatio J. Bilge, Jr. - 20 Nov 2007 18:06 GMT
That's a slick method. Thanks.
> Assuming there is always only 3, 5 or 7 numbers:
>
[quoted text clipped - 17 lines]
> > Thanks,
> > ~ Horatio
T. Valko - 20 Nov 2007 19:13 GMT
You're welcome. Thanks for the feedback!

Signature
Biff
Microsoft Excel MVP
> That's a slick method. Thanks.
>
[quoted text clipped - 21 lines]
>> > Thanks,
>> > ~ Horatio