Index of / Compare List

Hi Everyone,
I am working on some list, which some time the input list number does not match with the list that I want to get item from, for example my input is 35 but I don’t I have it in main list so it’s return -1 or same for 90.
but have 40 and 100, is there a way that I can define a node that when its return -1, go and get upper index.
for example if input is 35, take 40 from list and not return -1

I am not 100% sure what you are asking.
Do you want to take the next closest number if the number you are looking for is not in the list?

Edit:

I think this is what you are looking for.

2 Likes

yes exactly but not closer, the higher one for example for 35 take 40 instead of 32

Thanks a lot for your previous response it helped me a a lot. So, Could you help me what should I do this time if I want to choose closest number from the list?
if input is 35 choose 32 not 40

@amirjalaliafshar This should get you the closest number in the list.

2 Likes

I think a your required result as below script.

1 Like