If function in Sketchup Dynamic is used a lot and is quite simple, the structure is similar to Exel’s If function, this lesson will take practical examples to allow users to change the type of cabinet door. Flat styles, framed styles, glass doors, etc. Practical examples will help you quickly grasp the structure and use of the If function in Sketchup.
Note that authoring Dynamic Components (writing IF formulas and attributes) is a SketchUp Pro-only feature — since SketchUp moved fully to named-user subscriptions, the free web/Go tiers can interact with a finished DC but cannot edit its formulas. This still holds in SketchUp 2026, so build and test these examples in Pro.

Video Lesson:
Lesson objectives:
- Understand the basic structure of the IF function
- OR and And in the IF function
- IF function has many conditions
Steps to take:
- Step 1: Reuse the File cabinet door in the previous lesson
- Step 2: Set up each type of cabinet
- Step 3: Set up the drop down list
- Step 4: Set conditions for each component
Note:
- If the IF function has many conditions, you can copy and write in Notepad to see clearly the syntax, if many times it is quite difficult to read.
- The DC engine evaluates BOTH branches of every IF — not just the one that matches. So if a “then” or “else” expression references a sub-component that does not exist, divides by zero, or reads an attribute from a sibling that is hidden, you can get a red error even when that branch is never the active choice. Keep both branches valid for all cases, not just the one you expect to fire.
- When a single dropdown drives many attributes, deeply nested IFs become unreadable fast. The expert alternative is OPTIONINDEX paired with CHOOSE: the dropdown returns a position number, and CHOOSE(OPTIONINDEX, valueA, valueB, valueC…) picks the matching value per attribute. It scales to far more options than a chain of IFs and is much easier to debug.
- If you stay with IF and compare against the dropdown text, the match must be exact, including case and spaces — “Glass ” with a trailing space silently fails the comparison. OPTIONINDEX avoids this because it compares numbers, not strings. Note OPTIONINDEX is zero-based: the first list item is 0, not 1.

Tiếng Việt