BOUND Function

Constrains the value of a cell to a range or set of ranges.

Syntax

BOUND (value, type, ignore, value1, value2 [,ignore(n), value1(n), value2(n),...])

Remarks

Use the BOUND function to restrict a cell's value to an upper and lower bound, for example, to control objects that should not be stretched above or below a minimum or maximum height. The constraint can be inclusive or exclusive with respect to the range or ranges. If the current value should not be constrained, set the type parameter to 2 (disabled).

You can define multiple ranges by supplying multiple occurrences of the ignore, value1, and value2 parameters. Use the ignore parameter to disable constraints by a particular range.

The formula containing the BOUND function does not get overwritten when its value changes; instead, the formula is preserved and the new value is placed into the value parameter.

Example 1

This example uses the BOUND function to force a control handle to stay within the bounding box of a shape.

Controls.X1 = BOUND(Width*0.5, 0, FALSE, Width*0, Width*1)

Controls.Y1 = BOUND(Height*0.5, 0, FALSE, Height*0, Height*1)

Example 2

This example uses the BOUND function to constrain a shape's width to 2 in., 4 in., or 6 in.

Width = BOUND(, 0, FALSE, 2 in, 2 in, FALSE, 4 in, 4 in, FALSE, 6 in, 6 in)