7 Replies Latest reply on Dec 8, 2015 11:49 AM by Charley Saint

# Set a Variable with an Input Formula to Round Up

On a Data Card I have set a Variable to this Input Formula:

\$Mul(%Chillers_Pump_Pressure_60Hz_1st%,.644)

The value for Chillers_Pump_Pressure_60Hz_1st in one of my records is "35".  The calculation sets the second variable to "22.54".  Is there a way to set the variable to round up the calculated number to the next whole number, i.e. "23"?  I tried setting the variable to an "Integer Number" but that didn't change anything.

Thanks!

• ###### Re: Set a Variable with an Input Formula to Round Up

But that's only in the properties of a SolidWorks file, correct?  What I have is the BTUs at 60Hz value entered into a field on my Data Card, and then I want to run it through a formula to come up with a second variable to populate the BTUs at 50Hz field.  Nothing is coming from or going to a SW part or assembly. • ###### Re: Set a Variable with an Input Formula to Round Up

You can use function "round" in equations only.

• ###### Re: Set a Variable with an Input Formula to Round Up

That's what I was afraid of.

• ###### Re: Set a Variable with an Input Formula to Round Up

If you truly want to "round up" use this as your input formula (it adds 1, finds the decimal point and returns everything left of it):

• ###### Re: Set a Variable with an Input Formula to Round Up

Thank you!  That did it!

For the most part I understand what is going on with your formula except how everything to the right of the "." is being stripped off.  Is it as simple as "Left" is subtracting everything from the "Find" portion of the formula from the "Add" portion of the formula?

Thanks again!

• ###### Re: Set a Variable with an Input Formula to Round Up

Yup, so if the number was 12.34 then the find portion returns 2 since it's in position 2 in the string (1 is in position 0 and 2 is in position 1) so the left 2 characters of the number make 12 and voila.