Formula, doesn't calculate right!

I can’t figure out why the sizes over 89 doesn’t come out with 50?? (thouse marked with red)


The formula should be





Thanks Vikram

But it didn’t solve my situation.If I added a code block before the Formula the result where right.

It is like if the number is over 100 then it starts from the beginning again!!

I don’t know if it could be because it’s with 3 numbers?? (a guess)

1 Like


It actually does work alright even with your list

The problem with your formula is the position of the brackets.

If you just copy one of the formulas I’ve provided earlier and replace yours, it should work the way you expect it to.

Below is an example with a list similar to what is visible in your screen grab.


As you can see it does not work. I’ve added your suggestions. But Thanks for the try




Did you try flattening the list before feeding it to the formula?

Also, I’m using this build. The latest available.

Dimitar Venkov’s comment in this post regarding the IF node and Dynamo versions might be relevant to your case.


I have updated to the latest version of Dynamo… but it wasn’t the solution.

I have tried with a more simple formula, 2 times with different values… I think now that it could be something with my units??? or??


It seems to be considering only the first two digits.

Why don’t you report the issue here?

Hi Vikram

I’ve reported it. :slight_smile:

1 Like

Hi Jørgen

Interesting issue, you found in Dynamo. Can I ask what element and parametername are you look up with Element.Get.ParameterValueByName? When I try the formula if(x<=18,20(if(x<=28,30,(if(x<54,40,(if(x<=61,50,(if(x<=89,40(if(x<350,500,false))))))))))) with a number slider then the formula works correct. If I try with Categori (wall) and Parameter (Area) then the formula also works correct. I then wonder if it is the data, you bring to the formula, that Dynamo has an issue to read.

Palle Bisgaard


Hi Palle

It’s Pipe sizes from the Category “PipeInsulations”

Hi Jørgen

The issue for Dynamo is that the size number are redden as text and therefore you need to change it to a number. In the attached file, you will be able to see how we have splinted up the text list and converted into numbers.

If issue

Palle Bisgaard

guys i followed your discussion and suppose that the problem lies again in dynamos’ / revits’ unit conversion capabilities.

you guys are most propably working in millimeters but still (0.82xx) dynamo extracts inches.

as you can see when transferred from millimeters to inches and back the result is correct even for values >100


I managed to solve my problem. Thanks for the help

I’ve solved my problem with putting in the box “String.ToNumber” before the formula.

1 Like