Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select middle value within a range

Status
Not open for further replies.

ptlagow

Technical User
Sep 17, 2002
7
US
I have a listing with three columns. i would like to select the middle value, not necessarily the median, of the three. If there are less than 3 values select the lowest value.

Set up like this:

Credit Scores Selection
Vendor 1 Vendor 2 Vendor 3
718 756 745 745
650 650 660 650
625 612 612

Any help would be appreciated.
Right now I created the following, but there has got to be something easier.

=IF(B4=C4,B4,IF(B4=D4,B4,IF(C4=D4,C4,IF(OR(AND(B4>C4,B4<D4),
AND(B4>D4,B4<C4)),B4,IF(OR(AND(C4>B4,C4<D4),AND(C4>D4,C4<B4)),C4,D4)))))
 
Median would work for the examples you gave.

Try:
[COLOR=blue white]=if(count(A2:C2)<3,min(A2:C2),median(A2:C2))[/color]

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
Here's a starter: look up the SMALL (or LARGE) worksheet function
 
OK, maybe I'm being dense today, but what exactly do you mean by, "i would like to select the middle value, not necessarily the median, of the three"?

The median of three values will always be the 'middle' number. In your second example (650, 650 and 660), 650 will be returned as the median. And you indicate that you want it to return 650.

Am I missing something?

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
Quite right. Median works fine with 3 numbers; I got distracted from this fact by the OP stating they didn't want the median.

 
Sorry I did misspeak, and the median formula listed
=if(count(A2:C2)<3,min(A2:C2),median(A2:C2))
works perfectly!

Thanks to all
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top