Finding next higher and lower number in a list

Hello,
I am new to Grasshoper and have te following problem.
I have a list and want to find the next higher and lower value to a number and extract it to a new list.
Right now I only have a solution for giving me the closest point.

Hello
to find the highest you can
reverse the list and take the first value (i=0)
or put -1 as i, it will gave you the last value

I basically need the neighbouring numbers

What do you mean by reverse the list? Depending on the given number (here 0.25) it doesn´t always give me the lowest number. So in some case I also have the finde the next smaller number to my given number

I think I quite understand, but your first formulation was not clear. Also I think that abs doesn’t help to give for the following needs.
I think you can sort the list of number, find the number that is closest to you number then take index -1 and index +1 to find the neighbors.
To make a list of index use Series

Hi,

what about something like this?

High low value.gh (8.7 KB)

FIND NUMBER.gh (10.3 KB)

I don`t know if I’ve done something wrong, but its nots working for me

Upload your code//

No idea where this cluster comes from…

CLUS.gh (10.9 KB)

Sorry my mistake,

here you have the corrected version.

High low value.gh (9.0 KB)

my mystake, its working. thank you!!

Here’s another option:


Closest number.gh (24.5 KB)