View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
bj bj is offline
external usenet poster
 
Posts: 1,397
Default Return value from list based on criteria

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(yx,(Max-y)/(Max-x),(y-Min)/(x-Min)),1)+1

" wrote:

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