which function can get the desired result?

  • Thread starter Thread starter ADK
  • Start date Start date
A

ADK

Is there a function for this:

example:

cell B1 = 115
cell B2 = 120
cell B3 = 200

B1 thru B3 are variables that will change based on user input.
I want cell B4 to equal "CC" if B1 is closer to B2, but if B1 is closer to
B3 than B2, B4 will equal "C"

Any function(s) that can get this result?

Thanks
 
=IF(ABS(B1-B2)<ABS(B1-B3),"CC","C")

You haven't said what you want as an output if B1 is equidistant from B2 and
B3.
 
Back
Top