TRUE/FALSE NUMBER CLOSER/NEARER??-please help anyone

J

jiffy

hi all,
can anyone help me with this problem.
i am after a formula that produces a TRUE or FALSE when 2 or mor
different numbers are the closest to the objective number.
below are some examples.

500
is 275 closer to 500 than 400:answer: FALSE
is 400 closer to 500 than 275:answer :TRUE
basically the formula should be like this:which is closer to 500, 27
(false) or 400 (true).
or

15
is 16 closer to 15 than 17:answer:TRUE
is 17 closer to 15 than 16:answer:FALSE

hope everyone can understand the examples.
i also help someone out there can help me with this formual.
thankyou for reading this THREAD.
have a nice day.
regards
jiff
 
F

Frank Kabel

Hi
try the following (A1 stores your base number, e.g. 500, A2 the first
number and A3 the second number)
=IF(ABS(A2-A1)<ABS(A3-A1),TRUE,FALSE)
 
N

Nicky

assuming cells A1:B4 are populated thus:

this closer 299
than this 310
to this 300
answer TRUE

this formula in B4 gives the right answer

=(((B1-B3)^2)<((B2-B3)^2)
 
J

jiffy

dear frank and nicky,
thankyou, very much for your help.
you both have been a great help.
i will try out your ideas.
this is a great site.
all the best to you both and have a great week, whats left of it.
regards
jiff
 
J

jiffy

hi all again,
the formula's you gave me guys didn't work:
most of the answer's came up as true, probably because some of th
answers in the first parts of the formula's produced a minus number s
then that will always be less than any positive numbers.
below are some proper examples i have from my excel sheet.
cell (a1) base numbers:
below left hand column/2nd and 3rd column's which number closer
4087.21 4090.44 4109.28
4075.8 4082.54 4107.57
4050.08 4049.37 4070.36
4054.93 4043.29 4071.80
4053.02 4062.72 4080.44
4102.46 4117.17
4135.36
4114.78 4122.61 4134.42
4125.59 4131.45
4140.75
4150.56 4146.04 4170.42
4130.75 4109.23 4161.40
4070.46 4080.45 4090.44
4099.8 4106.89 4117.92
4111.5 4109.46 4123.59
4147.34 4159.27 4177.02
4135.55 4120.75 4168.14
4106.08 4094.78 4120.84
4067.91 4050.26 4109.11

when using the formula's given for the numbers above TRUE come's out o
all of them.
perhaps the formula may have to be in 2 stages or completel
different.
i wish i was as smart as you guys in figuring this one out.
i do hope you can help me out there.
thankyou for reading this again.
regards
jiff
 
J

jiffy

i figured it out guys sorry to have bothered you,
have a great week.
thankyou for everything
regards
jiff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top