Conditional Branch.If and Switch.(Power Automate Desktop)
This section introduces conditional branching, which switches the action to be executed depending on the situation.

Use of If and Switch
At a minimum, using only If is fine, since If can be used for any situation.
Switch is more appropriate than If when there are two or more branching conditions for a single variable.
Therefore, use If basically, and then use Switch depending on the situation.
How to use
If
If
Drag If from Conditionals onto the Workspace.

The "first operand" and "second operand" specify what is to be compared, and the operator specifies the comparison method.
Click {x} to specify variables.
The most common form is to specify a variable for the "first operand" and a fixed value or variable for the "second operand".
In the condition below, when the variable num_1 is 10, the result is True.

Between If and End, place the action you want to take if the result of the condition is True.
In the following example, Display message is executed only when the variable num_1 is 10.

Else if
Else if is an action to add a condition; drag it into the If.

In the following example, if the variable num_1 is 10 or more, the action in the IF is executed; if it is 5 to 9, the action in the Else if is executed.
Conditions are judged from the top.
If multiple conditions apply, only the action in the first applicable condition is executed.

Else
Else is an action to set the behavior if none of the conditions are met.
It can only be placed at the end of an If.

In the flow below, if the variable num_1 is 10 or more, the action in If is executed; if it is 5 to 9, the action in Else if is executed; if it is 4 or less, the action in Else is executed.

Switch.Switch and Case and Default case
Drag Switch from Conditionals onto the Workspace.

Specify variables in Values to Check.
Click {x} to select a variable that has already been created.

Drag the Case into the Switch.
In the flow below, the action to be performed changes depending on the button pressed for Display message Action.
There must be at least one Case in Switch.

Default Case specifies the action to be taken when no Case is matched.
It is used by dragging it to the end of Swicth.Default case may be omitted.

Formulas and Operators.How to specify multiple condition designations.
To specify conditions with mathematical expressions, use the following operators.This allows multiple conditions to be specified.
Operator | Conditions to be True |
---|---|
A = B | A and B are equal. |
A != B | A and B are not equal |
A < B | A is smaller than B |
A <= B | A is less than B |
A > B | A is greater than B |
A >= B | A is more than B |
A OR B | Either A or B is True |
A AND B | Both A and B are True |
OR and AND are evaluated at a lower priority, but can be enclosed in parentheses to increase the priority.
Although formulas can be used in both If and Switchchn, Switch is not suitable for complex formulas, so it is recommended to use them only in If.
For example, if the variable num_a and the variable num_b are both greater than or equal to 3, the condition is as follows.
Parameter | Value |
---|---|
First operand | %num_a >= 3 AND num_b >= 3% |
Operator | Equal to (=) |
Second operand | %True% |


Links
Examples of Use
Delete rows of Excel with specific conditions.
---
Discussion
New Comments
No comments yet. Be the first one!