Return value from list based on criteria

  • Thread starter Nikolay.V.Petrov
  • Start date
N

Nikolay.V.Petrov

I have two numbers - X and Y.

I want to get value from a sorted list, based on how close Y is to X.
Values in the list are let's say from 1 to 5.

The values X and Y are between same min/max ranges.

Example:
X=5
List values: 1,2,3,4,5
Min is 0
Max is 100


If Y=50 the returned value should be 5
If Y=25 or 75, the returned value should be 3
If Y=10 or 90, the returned value should be 1
and so on.

any ideas how to emplement?

thanks in advance
 
G

Guest

I am not really sure what you want to do
I assume you meant X = 50 in your example
Do you want integer values?
Where are the break points? (When does it change from 5 to 4, from 4 to 3,
etc)
What happens if X is not in the center of your range?
one method could be something similar to

=floor(4*if(y>x,(Max-y)/(Max-x),(y-Min)/(x-Min)),1)+1
 
N

Nikolay.V.Petrov

yep x=50
double values needed
break points - distributed even from max to avergare and from mni to
average, where the max distibution point is at average
 

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