|
-
Jun 22nd, 2009, 04:40 AM
#1
Thread Starter
Hyperactive Member
could you answer?
Ex.1
13 15 17 answer is 15
Ex.2
12 16 13 answer is 13
Ex.3
11 11 15 answer is 11
if 2 nos are equal the answer is the 2 equal,
if all nos are different the answer is middle
how to do this? also in excel
tnx
*****************
VB6,PHP,VS 2005
-
Jun 22nd, 2009, 10:13 AM
#2
Frenzied Member
Re: could you answer?
Put the first number in A1, the second in B1 and the third in C1, then use this to get the answer:
Code:
=IF(A1=B1,A1,IF(A1=C1,A1,B1))
-
Jun 22nd, 2009, 11:45 AM
#3
Re: could you answer?
Example number 2 seems to have the wrong answer, as all three numbers are different, so the answer should be the middle number, which is 16.
My usual boring signature: Nothing
 
-
Jun 22nd, 2009, 11:48 AM
#4
Re: could you answer?
I think the means the middle as in their size, not placement in the list. 16 > 13 and 13 > 12 so 13 is the 'middle' number. Isn't that called the median..?
-
Jun 22nd, 2009, 11:55 AM
#5
Re: could you answer?
Ok, I misinterpreted what was stated, but that makes more sense.
Actually, it IS the median, and for the case where more than one number is the same, you are getting the mode. Since both of those are built-in functions in Excel, that suggests an inferior solution. Mode returns NA for cases where all are different, so If not mode, get median. I doubt that could be written simply, though, but I have no recent experience with Excel.
My usual boring signature: Nothing
 
-
Jun 22nd, 2009, 11:05 PM
#6
Thread Starter
Hyperactive Member
Re: could you answer?
tnx to all here is the final solution:
=IF(A1=B1,A1,IF(A1=C1,A1,MEDIAN(A1:C1)))
*****************
VB6,PHP,VS 2005
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|