Find closest value from list B into list A

Hello,
I have two list (List A and List B) and I have to find closest value from list B into list A and make a new list with values from list A.
On the image are value and lists.
The results shuld be like:
0List (53.972,251.5819,404.6395)
1 List(260.0369)
2List(694.3665)

Thanks for help.

Hi @igor.petrovic

Are you looking to get this result?

1 Like

This should work …

The same in Design Script …

dff = Math.Abs(lstA<1> - lstB<1><2>);
ind = List.IndexOf(dff<1><2>,List.MinimumItem(dff)<1><2>);
cls = List.GetItemAtIndex(lstA<1>, ind<1>);
3 Likes

Hi Kulkul,
Yes, that was I looking.

Hi Vikram,
This work perfect.
Thank You.

1 Like