Group numbers in a list based on a range

Hello everyone,

Who can help me with the following:

I have a list A with numbers and I want to group from list B all numbers that are 400mm more and/or less than the numbers in list A.

How can I best get this done?

Thanks for contributing ideas.

You’ll need to handle the list levels properly but all you have is a conditional statement otherwise. Just check for values where:
A-400 < B < A+400;


Math.Absolute might be of use right after the subtraction. This will remove the need for testing 400 above and 400 below.

From there a single > node to test for values over 400 will produce a nested list of True/False values that can be used to group the values as needed via a List.FilterByBoolMask node.

1 Like

Hi Nick,

Thanks for the response and thinking along.

Only I can’t manage to properly process the if statement in the Design script.
I can’t seem to find anything similar to this on the forum.

Can you still help me on my way?

Hi Jacob,

I just can’t seem to get the method you describe.

I also don’t quite understand how to apply this in my script.

Maybe you would like to help me a little more?

@Fernand77 can you post the final outcome that you want?

Here is the particular node in question: Dynamo Dictionary

I’m at a conference until tomorrow evening so I won’t have time to help more than giving you advice as you work though the problem yourself. If you keep at it and find you are still struggling on Friday ping me again here and I’ll give it a more direct shot.

1 Like

This is what @jacob.small seems to have outlined above …

grp.dyn (15.2 KB)

List.FilterByBoolMask(b,(Math.Abs(b-a<1>) <= 400)<1>)["in"];


Thanx @Vikram_Subbaiah @jacob.small @Nick_Boyts , for your help!!

1 Like