Power Automate IF Expression [With 51 Examples]

In this Power Automate Tutorial, we will learn what is an IF expression in Power Automate, what is its syntax, and how to use the If expression in a flow.

Also, by taking various examples, we will discuss the below topics such as:

  • Power Automate IF expression
  • Power Automate IF expression examples
  • Power Automate If expression variable
  • power Automate expression IF greater than
  • Power Automate IF expression null
  • Power Automate IF expression boolean
  • Power Automate IF expression equals
  • Power Automate IF condition is equal to
  • Power Automate IF condition
  • power automate expression if or
  • Power Automate expression IF AND
  • Power Automate condition if it is approved
  • Power automate if an array contains
  • Power Automate IF expression contains
  • Power automate if person field is empty
  • Power automate if the date is null
  • Power Automate IF condition in email
  • Power Automate checks if an input string is an integer or not
  • Power Automate condition if the array is empty
  • Power Automate condition if the field is blank
  • Power automate IF date is today
  • Power automate if a date is less than today
  • Power Automate IF expression today is Monday
  • Power Automate IF attachment name contains
  • Power Automate IF date is greater than today
  • Power Automate IF day of the week
  • Power Automate IF cell is empty
  • Power automate IF file exists
  • Power automate IF column equals
  • Power Automate condition IF the attachment exists
  • Power Automate IF expression dynamic content
  • Power Automate condition if string is empty
  • Power Automate expression IF length
  • Power automate IF the body is empty
  • Power automate IF get items is empty
  • Power Automate if the filename contains
  • Power automate IF field changed
  • Power automate check IF list is empty

Table of Contents

Power Automate IF expression

Power Automate If Expression expresses the conditional statement. This is used to return the statement according to statements. If the statement matches, then it returns the true value, otherwise, it returns the false value.

The Microsoft Power Automate provides an IF statement that checks the logical expression or conditions in flow development. It checks whether the given statement is valid or not. If it is valid then it will return the True value otherwise it will return a false value.

Syntax:

In Power Automate, we can write the if expression within the Compose action. The syntax for the IF expression is:

if(expression, valeueIfTrue, valueIfFalse)

For example:

if(equals(12,21),'Equals','Not Equals')

The above expression checks the given values (12, 21) are equal or not and then it will return the output based on whether the expression is true or not. As both the values are not equal, so it will return the else part as ‘Not Equals‘.

The syntax of this expression is:

If(<expression>,True, False)

For example, we will insert below expression:

if(equals(1,0),'Same','Different')

Then it will return the output as ‘Different‘.

Also, read: Power Automate Multiple Conditions [With 19 useful examples]

Power Automate IF expression examples

Let us take an example of using an IF expression where we will insert an expression that will check whether the inserted date is greater than the current date or not. To create the flow, the following steps are:

  • On Power Automate, click on Create (on the left navigation panel) > Instant Cloud Flow > Select the trigger ‘Manually trigger a flow‘ > Create.
Create an instant flow on Power Automate
Create an instant flow on Power Automate
  • We can see, that the flow is started. Let’s insert an input inside the trigger, click on +Add an input > Date.
Power Automate If expression example
Power Automate If expression example
  • Now, we will add the logic expression inside the flow via the ‘Compose‘ action. Click on the +New step > search and select the action ‘Compose> Expression > Insert the below expression >Update.
if(greater(triggerBody()['date'],utcNow()),'The inserted date is greater than current date','The current date is greater')

Note – Here the ‘utcNow()‘ executes the current date i.e. 2022-05-04.

Example of IF expression in Power Automate
Example of IF expression in Power Automate
  • To see the execution, click on save > Test it manually. It will ask to insert a random date to run the flow (For example, the inserted date is 2022-05-06). Then click on the Run flow.
IF expression example in Power Automate
IF expression example in Power Automate
  • Now, as the inserted date is greater than the current date it returns the true value i.e., ‘The inserted date is greater than the current date‘.
Give an example of IF expression in Power Automate
Give an example of IF expression in Power Automate

This is how to give an example of IF expression in Power Automate.

Let’s take an example to check the condition whether it is true or not. For example, if the age of a person is greater than or equal to 18 then he is eligible to give a vote otherwise he is not eligible. Now we will see how to implement this logic through Power Automate.

Example-1: Using If expression

Step-1:

On Power Automate, first, we will trigger the flow manually. In that trigger, we will add the number as our input.

Power Automate If expression example
Power Automate If expression example

Step-2:

Now we will insert the below expression in a Compose action to check whether the person is eligible or not eligible to give a vote.

if(greaterOrEquals(triggerBody()['number'],18), 'Eligible', 'Not Eligible')
If expression in Power Automate
If the expression in Power Automate

Now we will check the flow by running it. When we will test it, it will ask us to insert the person’s age. For example, we will insert 27.

If expression in Microsoft flow
If expression in Microsoft flow

We can see the final result will come as ‘Eligible’:

If expression example in Power Automate
If expression example in Power Automate

Similarly, let’s insert the age as 12, then it will return the output as ‘Not Eligible’:

Example of IF expression in Power Automate
Example of IF expression in Power Automate

This is how to use IF expression on Power Automate flow.

Read Power Automate vs UiPath

Example-2: Using IF(condition) action

In Power Automate, there is a Condition (Control) action to implement the condition. Now we will see how to use this action to check the condition of a flow.

After triggering the flow manually, search for Condition under control action. Then add this action to our flow.

Then insert the value to check and their IF yes & IF no values like below.

Power Automate If condition action
Power Automate If then else

When we will test the flow, it will ask to insert the age. For example, we will insert the age as ’16’. As the value is not matched with the condition, so it will return the False value i.e. If no part:

Example of IF Condition in Power Automate
Example of IF Condition in Power Automate

This is how to use the If-Condition action in power Automate.

Check out: Power Automate Parallel Branch with Examples

Power Automate IF condition

In Power Automate, there is another way to apply a condition in the flow i.e. Condition control. Let us take the previous example of whether the inserted date is greater than the current date.

To create the flow, the following steps are:

  • On Power Automate, create an Instant Cloud Flow that triggers it manually and has a date input inside it.
  • Under the trigger, we will add a ‘condition‘ control where we will use values and operators such as:
    • Choose a value (First)- Trigger Date (Select it from the dynamic content)
    • Operator– Is greater than
    • Choose a value (Second)- To get the current date use the below expression.
utcNow()
Power Automate if condition
Power Automate if condition
  • If the condition matches, then it will return the true statement. So in the ‘If yes‘ section, add a compose action and set a true statement. Similarly, we will add a false statement in the ‘If no‘ section that will execute when the condition will not match.
Power Automate if condition example
Power Automate if condition example

Now the flow is fully complete. Let’s test it. Click on save > test > manually. It will ask to insert a date that you want to test (ex- 2022-04-04). Click on the run flow. As the inserted date is not greater than the current date (ex- 2022-05-04) so it returns the false statement.

IF condition in Power Automate
IF condition in Power Automate

This is how an IF condition works in a flow.

Power Automate IF expression null

Here, we will see how to handle the null value using the IF expression in Power Automate. For example, we have a Sharepoint list having the Student’s names (single line of text) and their result(number) included null value.

Power Automate IF expression using null
Power Automate IF expression using null

Now we will create a flow that will check if the result is null, then it will update it as 0. To create the flow, the following steps are:

  • On Power Automate, create an Instant Cloud Flow that will trigger manually. Click on Create > Instant Cloud Flow > Manually trigger a flow > Create.
  • To get all the items from the SharePoint list, we will add an action under the trigger. Click on + New step > Get items. Provide the SharePoint site name and the list name.
Using null expression in condition
Using null expression in condition
  • To insert the condition, add a ‘Condition‘ control. Set the value as:
    • First value – Result (Select it from the dynamic content)
    • Operator – is equal to
    • Second value – null (use as an expression)
How to check if value is null with new condition parameters using Power Automate
How to check if the value is null with new condition parameters using Power Automate
  • According to the condition, if the result is null then it will update as 0. In the ‘If yes’ section, click on +Add an action > Update Item. Set the properties such as:
    • Site address- Provide the site address
    • List name- Select the list name
    • Id- Select Id from the dynamic content
    • Title- Select Title from the dynamic content
    • Result- 0
Checking if field is empty or null in MS Flow
Checking if the field is empty or null in MS Flow

Now save the flow, click on test > Manually > Run flow > Done. We can see it will update those fields whose value has null.

Power Automate how to Check if field is Empty or Null
Power Automate how to Check if the field is Empty or Null

This is how to check if the field is empty or null using Power Automate.

Power Automate If expression null [Another Example]

Here we will see how to deal with an empty or null value in Power Automate using IF expression. For example, if we insert any value as input then it will return that value as an output otherwise a null value will come.

Do you have any idea, how to implement this in Power Automate Flow? Fine, here is the answer.

Step-1:

In Power Automate, first, we will trigger the flow manually. Then we will add a Compose action. Here we can use any value(except integer) as input or we can use a null value by using a Null expression.

Power Automate If expression with null
Power Automate If expression with null

Step-2:

Again we will use Compose action, where we will use an expression that will check whether the input is null or not:

if(empty(outputs('Compose_2')),'Null',outputs('Compose_2'))
How to check if value is null with new condition parameters
How to check if the value is null with new condition parameters

As per the condition, if there is a null value then it will return the output i.e. ‘Null‘; Otherwise, it will return the input value as output i.e. Howdy.

Using null expression in condition Power Automate
Using null expression in condition Power Automate

Let’s take another example, where we will use a null as input:

Make a condition to check for empty fields or null values in Microsoft flow
Make a condition to check for empty fields or null values in Microsoft flow

The output will appear like below:

expression to check for blank values in power automate
expression to check for blank values in power automate

As the input was a null value, so it returned the output as Null.

Similarly, we can use this logic on Condition action in Flow:

Check a field is empty or not in MS Flow
Check a field is empty or not in MS Flow

In condition, it will check if the output of Compose-2 is null then it will return the ‘If yes’ part; otherwise it will return the ‘If no’ part.

Power Automate If Is Null
Power Automate If Is Null

This is how to use the null expression in conditions in Power Automate to check the null value.

Read: Power Automate email body formatting

Power Automate IF condition is equal to

Here, we will see how to use the ‘equals‘ in an IF expression or a condition action. To implement this, we are going to use the previous SharePoint list (i.e. StudentResults) and also, and we will add a single line of text column (i.e. Grade) to show the grade.

Power Automate IF expression equals function
Power Automate IF expression equals function

Now we will create a flow that will check if the result is equal to 0 then the grade will fail otherwise it will be a pass. To create this flow, the following steps are:

  • On Power Automate, create an instant cloud flow that triggers the flow manually.
  • Then add an action ‘Get items‘ to retrieve all the items from the SharePoint list. Under the trigger, click on + New step > Get items. Provides the SharePoint site address and the list name.
  • Next, add a condition control to check whether the result is equal to 0 or not, and then update the grade as per the result. Click on the + New step > Condition. Set the value and the operator as:
    • Choose a value – Result (select it from dynamic content)
    • Operator – is equal to
    • Choose a value – 0
  • If the condition matches, then it will move to the ‘If yes‘ section; otherwise, it will move to the ‘If no‘ section and update the grade as per the condition.
    • In the ‘If yes‘ section, click on +Add an action > update item. Provide the site address and the list name, ID, and Title, in the grade, set the value as ‘Fail‘.
    • Similarly, repeat this process in the ‘If no‘ section and set the value as ‘Pass‘ in the Grade column.
Power Automate if condition using equals to
Power Automate if condition using equals to

Let us save the flow and test it manually. Run the flow. We can see it will update the grade in the result list.

Power Automate if condition equals to
Power Automate if condition equals to

This is how to use equal to in a Power Automate IF condition.

Also, read: Power Automate Do until

Power Automate expression IF greater than

Here we will see how to use the math function ‘greater than‘ within a condition in a flow. To implement this, let’s create a flow and the following steps are:

  • On Power Automate, create an Instant cloud that will trigger manually. (Follow the previous example to create this flow.)
  • Inside the trigger, add 2 number inputs. Click on +Add an input > Number.
Power Automate if greater than
Power Automate if greater than
  • To compare the number, we will add a ‘Condition‘ control or we will add a ‘compose’ action using ‘Greater than‘ to this flow. Here we are going to use a condition control action. Click on + New step > Condition. Set the values and the operator such as:
    • Choose a value (first) – Number1 (From Dynamic content)
    • Operator – Is greater than (select it from the drop-down)
    • Choose a value (second) – Number2 (From Dynamic content)
Power Automate if condition greater than
Power Automate if the condition is greater than
  • If the condition matches, then it will move to the ‘If yes‘ section and show the greater number or true statement. In the ‘If yes‘, click on + Add an action > Compose. Insert the below inputs:
Number1
 is greater than ⁠
Number2

Note – Select both Number1 and Number2 from the dynamic content.

If condition is greater than in Power Automate
If the condition is greater than in Power Automate
  • Now save the condition and test it manually. Then it will ask to insert 2 dynamic numbers. For example, 51 and 25. Click on run flow to see the output.
If condition is greater than in Power Automate
If the condition is greater than in Power Automate
  • As the condition is true, so it will execute the ‘If yes‘ section; otherwise, it will execute the ‘If no’ section. So the output will look like the below:
Power Automate Flow if condition is greater than
Power Automate Flow if a condition is greater than

This is how to implement if the condition is greater than.

Check out: Power Automate create a task in Microsoft Planner

Power Automate IF expression variable

Here, we will see how to use variables within Power Automate IF expression.

  • Let’s create an instant cloud flow that will trigger the flow manually. Under the trigger, add an ‘Initialize variable’ action and initialize a float variable. Click on + New step > Initialize variable.
    • Name- Value1
    • Type- Float
    • Value- 12.5
  • Again, add another ‘Initialize variable‘ and initialize a float variable with a different value.
    • Name- Value2
    • Type- Float
    • Value- 13.7
Power Automate If expression using variable
Power Automate If expression using variable
  • To use these variables within an IF expression, add a compose action. Click on + New step > Compose. Insert the below expression as compose input.
if(lessOrEquals(variables('Value1'),variables('Value2')),'True','False')
Power Automate using variable in IF expression
Power Automate using a variable in IF expression
  • Now save the flow and test it manually. As per the expression if the first variable is less or equal to the second variable then it returns True otherwise returns False.
Power Automate Use If Expression to Evaluate a Variable
Power Automate Use If Expression to Evaluate a Variable

This is how to work with IF expression variable in Power Automate.

Power Automate If expression variable [Another Example]

Here we will see how to use the If condition to check variables in Power Automate. For example, if the variable is blank then it will give an output as ‘No value’ otherwise it will return the value assigned in the variable.

To implement this, we will assign an integer type variable in the flow:

Power Automate If expression variable
Power Automate If expression variable

Then we will use a compose action with an expression that will check whether the variable is blank or not:

if(equals(variables('VarNumber'),0),'No value',variables('VarNumber'))
Power Automate If expression blank
Power Automate If expression blank

As it is a blank variable, so the out will come as ‘No value’:

How to use if expression in Power Automate
How to use if expression in Power Automate

Similarly, if we insert any value on that variable then it will show that value as output:

If expression with blank in Power Automate
If expression with blank in Power Automate

This is how to use the If expression in a variable in Power Automate flow.

Power Automate If expression greater than

In Power Automate, there is a logical function named ‘greater(value, compare To)’ that returns true if the first argument is greater than the second argument.

For example, we will create a flow that will check whether the date has expired or will come. To implement this, we will trigger the flow manually where we will use the date as input.

Then we will use the below expression on Compose action:

if(greater(triggerBody()['date'], utcNow('yyyy-MM-dd')),'This is date will come','This date has expired')
Power Automate If expression greater than
Power Automate If expression greater than

Let’s check this flow by entering a random date that has already gone from today’s date:

Logical function in Power Automate
Logical function in Power Automate

Let’s take another example by inserting a future date from today(i.e. 11/18/2021):

If expression greater than in Microsoft Flow
If expression greater than in Microsoft Flow

This is how to compare two dates, string, float, and number using If expression greater than in Power Automate.

Read Power Automate Concatenate String

Power Automate IF Condition Boolean

In this example, we will see how to use boolean in a Power Automate IF condition. For this, we are going to use a SharePoint list based on faculties having some random data.

Apart from this, there is a ‘Yes/no‘ column ‘Attended‘ it mentioned whether the faculty attended that tutor or not.

Power Automate IF expression boolean
Power Automate IF condition boolean

Next, we will create a flow that will check whether the faculty is attending or not. To create the flow, the following steps are:

  • On Power Automate, create an instant cloud flow that triggers it manually.
  • Then add a ‘Get items‘ action that will retrieve all the items from the SharePoint list. Provide the Sharepoint list and the Site address.
  • Next, add a ‘Condition‘ control and provide the below parameters:
    • Value (first) – Attended (select it from the dynamic content)
    • Operator – is equal to
    • Value (second) – True (use it as an expression)

We can see it will create an apply to each loop automatically.

If condition Boolean in Power Automate
If condition Boolean in Power Automate
  • In the If yes section, add a compose action. Inside the compose, insert the faculty in charge name, date, and attendee details.
Using Boolean in Power Automate IF condition
Using Boolean in Power Automate IF condition
  • Now save the flow and test it manually. We can see it will show only those faculty’s data who attended the tutor.
Power Automate using Boolean in IF Condition
Power Automate using Boolean in IF Condition

This is how to use boolean in Power Automate IF condition.

Read: Power Automate Copy Folders + 10 Examples

Power Automate IF expression equals

Here, we will see how to use ‘equals‘ within Power Automate IF expression. To implement this, we will create an ‘Instant cloud flow‘ on Power Automate that trigger the flow manually.

  • In that trigger add 2 number inputs where we can insert numbers randomly. Inside the trigger, click on +Add an input > Number.
  • Then add a compose action where we will insert the below expression.
if(equals(triggerBody()['number'],triggerBody()['number_1']),'Equal','Not equal')
Power Automate IF expression using equals
Power Automate IF expression using equals
  • Now, save the flow. Click on test > manually. We can see it will ask to insert two numbers. Press ‘Run flow‘. For example, we will insert 25 & 23.
How to use equals in Power Automate IF expression
How to use equals in Power Automate IF expression

As both the numbers are not equal, then the output will come as ‘not equal‘.

Refer: Power Automate Copy Files + 21 Examples

Power Automate If equals

A equals() function needs arguments to compare and return true if they are equals. Here we will see how the equals() function works with if expression on Power Automate.

To implement this function, we will take two values on our flow i.e. value1, value2.

Then we will use the expression to check whether the values are equal or not in a Compose action:

if(equals(triggerBody()['number'],triggerBody()['number_1']),'Both values are equal', 'Both are not equal')
Power Automate If expression equals
Power Automate If expression equals

Now our flow is ready to run. Let’s insert two values to check whether they are equals or not:

Power Automate If expression to check values equals or not
Power Automate If expression to check values equals or not

Similarly, if we will insert two different values then it will return the False(i.e. Both are not equal). This is how to check whether the values are equal or not in Power Automate.

Read How to convert decimal to whole number in Power Automate

Power Automate expression if or

Here we will see how to use the ‘or‘ operator in the IF expression within Power Automate.

For example, there is a SharePoint list named ‘Vehicles‘ having some columns and some random data such as:

Power Automate IF expression OR
Power Automate IF expression OR

Now we will create a flow, that will show those data whose state is equal to ‘Texas’ or ‘England’. To create this flow, the following steps are:

  • On Power Automate, create an Instant cloud flow that triggers the flow manually.
  • Under that trigger, add an action ‘Get items‘ that will fetch all items from the SharePoint list. Provide the SharePoint site address and the list name.
  • Next, add an action ‘Apply to each‘ and set the ‘Value’ as an output from the previous step.
  • Inside the ‘apply to each‘ add a ‘Compose‘ action using the below expression.
if(or(equals(item()?['State'],'Texas'),equals(item()?['State'],'England')),'Condition Satisfied','Condition Not satisfied')
Power Automate using OR in IF expression
Power Automate using OR in IF expression

Now save the flow and test it manually. We can see the output below:

If expression using OR Power Automate
If expression using OR Power Automate

Note- As there are 8 items and the 1st item satisfies both the conditions, the output came as ‘condition satisfied’.

Power Automate expression if or [Another Example]

Here, we will see how the OR operator works with Power Automate flow. An OR operator returns true when one of the conditions is true or both conditions are true. Otherwise, it returns false.

For example, we have 2 numbers inputs, where we will put 2 conditions. One is if the first number is equal to the second number or if the first number is greater than the second number then it returns TRUE; otherwise, it returns FALSE.

Let’s create a flow to implement our requirement:

First, we will trigger the flow manually and add 2 number inputs for inserting numbers dynamically.

power automate expression if or
power automate expression if or

Then we will add a condition action to check the condition using OR operator:

power automate expression if using or
power automate expression if using or

Similarly, instead of Condition action, we can use these conditions in an expression format like below and we can use this expression in a Compose action.

if(or(equals(triggerBody()['number'],triggerBody()['number_1']),greater(triggerBody()['number'],triggerBody()['number_1'])),'True','False')
If condition using OR in Power Automate
If condition using OR in Power Automate

Now our flow is ready to test. Let’s insert two numbers to check the conditions (make sure if one of the conditions is true then it returns true otherwise it returns false). For example, here we will take 50 and 45 as two inputs respectively. Have a look at the output:

If expression using OR Microsoft flow
If expression using OR Microsoft flow

This is how to use Power Automate expression if using OR.

Power Automate expression IF AND

Similarly, here we will see how to use the ‘AND‘ operator within the IF expression in Power Automate. Also, we are going to use the previous SharePoint list i.e. Vehicles.

Now we will create a flow, that will show those data whose country is equal to ‘USA’ and state is equal to ‘California’. To create this flow, the following steps are:

  • On Power Automate, create an Instant cloud flow that triggers the flow manually.
  • Under that trigger, add an action ‘Get items‘ that will fetch all items from the SharePoint list. Provide the SharePoint site address and the list name.
  • Next, add an action ‘Apply to each‘ and set the ‘Value’ as an output from the previous step.
  • Inside the ‘apply to each‘ add a ‘Compose‘ action using the below expression.
if(and(equals(item()?['Country'],'USA'),equals(item()?['State'],'California')),'Condition Satisfied','Condition Not satisfied')
Power Automate expression IF AND
Power Automate expression IF AND

Now save the flow and test it manually, run the flow. We can see from those 8 items, the 6th item satisfied the condition i.e. that contain both the country USAand the state California‘.

Power Automate IF expression using OR
Power Automate IF expression using OR

This is how to do Power Automate IF expression using OR.

Read Microsoft flow Send an email showing wrong time for SharePoint list column

Power Automate if statement And

Here, we will see how to use conditional statement with AND operator on Power Automate. An AND operator returns true if both parameters are true; otherwise, it returns false. To implement this, we will take the example that was used previously.

We have already used one condition to check whether the VarArray contains a specified item(i.e. Ottawa) or not. Now, we will add another condition using And operator i.e. to check whether the length of the variable is greater than 5 or not. For this the flow will be:

Power Automate IF statement AND
Power Automate IF statement AND

Let’s run this flow to see the output:

If condition with And in Flow
If condition with And in Flow

As the length of the variable is 4 so the condition did not match and the output returns false. This is how to do Power Automate if statement AND.

Also, read: Power Automate Create PDF + 11 Examples

Power Automate condition IF it is approved

In this example, we will see how to work if the request is approved and then it will notify the requestor about the request.

To implement this, we have prepared a SharePoint list based on ‘Office Expenses‘ having some columns such as:

ColumnsType
ExpensesChoice
UnitsNumber
Apply DateDate and Time
Created ByDefault
StatusChoice
Power Automate IF approved
Power Automate IF approved

Now we will create a flow, that will when a user requests an office expense, then it will send to the HR and if HR approves the request then it will notify the user about the request. Also, update the status in the SharePoint list.

To create the flow, the following steps are:

  • On Power Automate, create an automated cloud flow that will trigger when an item is created in the SharePoint list.
  • On Power Automate > Create > Automated cloud flow > select the trigger ‘When an item is created‘ > Create. Provide the SharePoint site address and the list name.
Power Automate IF it is approved
Power Automate IF it is approved
  • Then, it will create an approval request and send it to HR, waiting for the response. Click on +New step > select ‘Start and wait for an approval. Set the properties such as:
    • Approval type – Approve/Reject – First to respond
    • Title – Specify the title of the request.
    • Assigned to – Give an email id who will respond to the request.
    • Details – Set the request details using the dynamic content.
    • Item link – Link to item (Select it from the dynamic content).
If approved in Power Automate
If approved in Power Automate
  • Now, we will add a condition control and add values that will check if the response is equal to approve. Click on + New step > Condition control. Set the value as:
    • Value– Responses approver response (From the dynamic content)
    • Operator– is equal to
    • Value– Approve
Power Automate IF condition approve
Power Automate IF condition approves
  • If the response is approved, then it will send an email notification to the requestor. In the ‘If yes‘ section, click on + Add an action > Send an email. Set the requestor’s email id, email subject, and body.
  • Next, the status will update in the SharePoint list. Under the ‘Send an email action, click on + Add an action > Update Item. Provide the SharePoint site address and the list name. Give the ID from the dynamic content and set the status as ‘Approved‘.
  • Similarly, repeat this process in the ‘If no‘ section. Add both the ‘Send an email‘ and ‘Update item‘ actions. Set the status value as ‘Rejected‘. It will execute if the response is rejected.
Power Automate condition if it is approved
Power Automate condition if it is approved
  • Now save the flow. Click on Test > Manually. For testing purposes, insert an item detail in the SharePoint list.
Power Automate flow condition if it is approved
Power Automate flow condition if it is approved
  • It will send an approval request to the specified user or HR.
Microsoft flow condition if it is approved
Microsoft flow condition if it is approved
  • Let us approve the request and we can see once the request approve it will send an email notification to the requestor.
MS flow condition if it is approved
MS flow condition if it is approved
  • Also, we can see the status is got updated in the SharePoint list:
Power Automate condition if approved
Power Automate condition if approved

This is how to work with Power Automate conditions if approved.

Check out: Start and wait for an approval Power Automate [Complete tutorial]

Power automate IF array contains

In this example, we will see an array with the ‘contains‘ function in an IF using Power Automate. To implement this, the following steps are:

  • Let us create an Instant cloud flow on Power Automate.
  • Next, initialize an array variable. Click on +New step > Initialize a variable. Set the parameters such as:
    • Name- VarArray
    • Type- Array
    • Value- [“Texas”, “California”, “Scotland”, “NewYork”]
  • Now, add a compose action where we will add the below expression that will return a true value if the array contains a specific value (ex- England); otherwise, it will return the false value. Click on +New step > Compose > Insert the expression > Update.
if(contains(variables('VarArray'),'England'),true,false)
Power automate if array contains
Power automate if an array contains
  • Let’s save the flow and test it manually. We can see it will return the false value as the array does not contain the specified value i.e. England.
Power automate IF expression array contains
Power automate IF expression array contains

This is how to work with expression if an array contains a specific value using Power Automate.

Power Automate IF expression contains

Similarly, here we will see how to use the ‘contains‘ function in an IF expression without using an array. To implement this, we are going to use a SharePoint list based on Products having columns such as Title and vendor.

Power Automate IF expression contains
Power Automate IF expression contains

Now we will create a flow that will show the true value if the vendor column contains a specified value; otherwise, it will show the false value. To create the flow, the following steps are:

  • On Power Automate, create an Instant cloud flow that will trigger the flow manually.
  • Next, add an action ‘Get items‘ that will retrieve all the items from the specified SharePoint list. Click on +New step > Get items. Specified SharePoint site address and the list name.
  • Add an action ‘Apply to each’ and set the ‘value‘ as an output from the previous step. Inside the ‘apply to each‘ add a compose action using the below expression.
if(contains(item()?['Vendor'],'Adobe'),'Yes','No')
Power Automate IF expression using contains
Power Automate IF expression using contains

Now the flow is ready to run. So save this flow and test it manually. We can see the output will come as NO where the vendor does not contain the specified value. Similarly, the output will come as Yes where the vendor contains ‘Adobe.’

Power Automate IF expression using contains function
Power Automate IF expression using contains function

This is how to do Power Automate IF expression using contains function.

Power Automate if statement contains [Another Example]

Here we will check how to check a string or array whether it contains a specified text or not. For this, we will initialize an array variable:

power automate if statement contains
power automate if statement contains

For example, we will check whether the array variable contains a specified value or not i.e. Ottawa. So we will add a Condition action to check this:

power automate expression if contains text
power automate expression if contains text

As the variable contains that value i.e. Ottawa, so it executes the If yes part.

Power Automate – how do we check if a property exists in the Array
Power Automate – how do we check if a property exists in the Array

This is how to check if a property exists or not in the array variable on Power Automate.

Read: Power Automate copy list item to another list with attachments

Power automate IF person field is empty

In this example, we will see how to check if a person’s field is empty in a SharePoint list using Power Automate. To implement this, we are going to use the previous SharePoint list named ‘Faculties‘ having a person field with empty data.

Power automate if person field is empty
Power automate if person field is empty

To create the flow, the following steps are:

  • On Power Automate, create an instant cloud flow that triggers the flow manually.
  • Then add an action ‘Get items’ that will retrieve all the items from the given SharePoint list. Under the trigger, click on + New step > Get items. Provide the SharePoint site address and select the SharePoint list.
  • Add a ‘condition’ control action. Add the values such as:
    • Value (first) – Faculty Incharge (from the dynamic content)
    • Operator – is equal to
    • Value (second) – null (Use it as an expression)

It will automatically create an ‘apply to each‘ loop.

  • If the condition got matched, then it will show the specified data using a ‘compose‘ action. Click on + New step > Compose.
Power automate if a SharePoint person field is empty
Power automate if a SharePoint person field is empty
  • Now the flow is ready to run, so save the flow and test it manually. We can see the output will appear like below:
Set SharePoint Person Field to Null in Power Automate
Set SharePoint Person Field to Null in Power Automate

This is how to handle Power automate if a person’s field is empty.

Power Automate IF Date is null

In this example, we will see how to check if the date has a null value in the Sharepoint list. Here, we are going to take the previous ‘faculties‘ SharePoint list with some little modification which means the date column has some null field.

power automate if date is null
power automate if the date is null

To check the empty date column, we are going to create a flow and the following steps are:

  • On Power Automate, create an instant cloud flow that will trigger the flow manually.
  • To get all the items from the SharePoint list, add the ‘Get items’ action and provide the site address as well as the SharePoint list.
  • Next, add an action ‘Apply to each’ under the ‘get items’ action and the ‘value’ from the dynamic content as the output of the previous step.
  • Inside the ‘apply to each, add a condition control action where we need to insert the values such as:
    • Value (First condition) – Insert the below expression
empty(items('Apply_to_each')?['Date'])
  • Operator- Is equal to
  • Value (Second condition) – Insert the below expression
bool('True')
  • If the condition gets satisfied, then it will move to the ‘If Yes’ section and show a message to mention the date. Inside the ‘If yes’ section, add a compose action and add some messages.
Power automate if the date field is null
Power automate if the date field is null

Now, click on Save and test the flow manually. As the second item has a null date field, the condition got satisfied and the outcomes will look like the below:

Power Automate flow check if date is empty or null
Power Automate flow check if the date is empty or null

This is how to check if the date is empty or null using the Power Automate flow.

Read: Power Automate get items examples

Power Automate IF condition in email

Here we will see how to use the IF condition in an email within Power Automate. For example, we have a SharePoint list based on a task list having some random columns and data such as:

Power Automate If expression in email
Power Automate If condition in email

Now we will create a flow that will notify the user if an item is modified by another user. For example, on the above list, all the items are modified by Sonam subhadarsini. According to the flow if any of the items is modified by a different user, then it will notify the main user i.e. Sonam subhadarsini via outlook.

To create the flow, the following steps are:

  • On Power Automate, create an automated cloud flow > select the flow ‘When an item is created or modified > Create. Provide the SharePoint site address and the list name.
  • Add a condition to check whether the modified person is the same or not to the main user. Click on +New step > Condition. Set the values such as:
    • Value (for the first condition) – Modified by display name from the dynamic content
    • Operator – Is not equal to
    • Value (for the second condition)- Specify the main user name i.e. Sonam Subhadarsini
  • In the ‘If yes‘ section, add an action to notify the main user. Click on +Add an action > Send an email. Set the properties such as give a user mail to whom want to send the mail, email’s subject, and body.
Power Automate IF condition in email
Power Automate IF condition in email
  • Click on the Save button and test the flow. For testing purposes, let us modify an item from another user.
IF condition in email using Power Automate
IF condition in email using Power Automate
  • We can see it will send an email notification to the specified user via outlook.
Power Automate flow IF condition in email
Power Automate flow IF condition in email

This is how to do Power Automate flow IF condition in email.

Power Automate If expression in email [Another Example]

Here, we will see how to use if condition with email in Microsoft flow. For example, we have a SharePoint list with some data and we want that whenever the data got modified or created by someone except the specified owner, then it will notify the owner.

To implement this, we have created a SharePoint list like the below:

Power Automate If expression in email
Power Automate If expression in email

Then we will create a flow that will check if the item is modified by someone except the specified then it will notify the owner.

If Statement Expression in Email Power Automate Flow
If Statement Expression in Email Power Automate Flow

Let’s create or modify an item from another user ID in the SharePoint list to check this flow.

If expression in email MS Flow
If expression in email MS Flow

As the new item is created by another user, so it will notify the owner or specified email id.

If Expression in Email Power Automate Flow
If Expression in Email Power Automate Flow

This is how to work with If expression in email in power Automate flow.

Read Microsoft flow change true to yes

Power Automate checks if an input string is an integer

Here we will see how to check whether the input is a string or an integer. For this, we will create a flow-on Power Automate. To create the flow, the following steps are:

  • On Power Automate, create an Instant Cloud flow that will trigger the flow manually.
  • Next, we will initialize a variable under the trigger. Click on +New step > Initialize a variable. Set the properties such as:
    • Name – VarIsInteger
    • Type – Boolean
    • Value – true
  • Similarly, again we will initialize another variable and set the parameters such as:
    • Name – VarInput
    • Type – String
    • Value – 687xyz
Power Automate IF expression string
Power Automate IF expression string
  • Next, add a ‘Compose‘ action and set the below expression to convert the ‘VarInput’ to an integer.
int(variables('VarInput'))
Power automate if integer
Power automate if integer
  • Next, add a ‘set variable‘ and set the variable ‘VarIsInteger‘ as false. Click on +New step > set variable.
How to check if a string is numeric in Power Automate
How to check if a string is numeric in Power Automate
  • Then go to the ‘Configure run after’ of the ‘set variable‘ action. Set it as ‘has failed‘ and click on ‘Done‘.
Power Automate How to check if a string is numeric
Power Automate How to check if a string is numeric
  • Next, we will add a ‘Condition‘ action that will check whether the variable ‘VarIsInteger‘ is true or false. Click on +New step > Condition. Set the values and operator of the conditions such as:
    • Value (First) – VarIsInteger
    • Operator – is equal to
    • Value (Second) – true
Power automate check if integer
Power automate check if integer
  • Similarly, click on the ellipses and select the ‘Configure run after‘ of the condition action. Set it as ‘is successful‘ and ‘is skipped‘. Click on done.
Power Automate check if it is string
Power Automate check if it is a string
  • If the condition got satisfied, then it will return the true value; otherwise, it will return the false value. In the ‘If yes’ section adds a ‘compose’ action and set a return value i.e. Yes the input is an Integer.
  • Similarly, add another compose action inside the ‘If no’ action and set a return value as well.
Power Automate check IF expression string
Power Automate check IF expression string
  • Now the flow is ready, let’s save the flow and test it manually. Click on ‘run flow‘. we can see the output will come like below:
How to determine if a string is numeric in Power Automate
How to determine if a string is numeric in Power Automate
  • Similarly, if we set the variable value (i.e. VarInput) as ‘678‘ or any numeric then the output will appear like below:
Microsoft Flow How to determine a string is numeric
Microsoft Flow How to determine a string is numeric

This is how to determine if a string is numeric using Power Automate.

Also, read: Power Automate conversion of string

Power Automate IF array is empty

There is a function ‘empty()‘ in Power Automate that will check whether an array/ object/ string is empty or not and return the output as a boolean i.e. true or false.

In this example, we will see how to check if an array is empty or not in Power Automate. To implement this, we are going to use the previous SharePoint list i.e. Faculties.

Now we will create a flow that will check whether the input array is empty or not. To create the flow, the following steps are:

  • On Power Automate, create an Instant cloud flow that triggers the flow manually.
  • Add a ‘get items‘ action that will get all the items from the specified list. Click on + New step > Get items. Provide the SharePoint site address and the list name.
  • Next, add a ‘compose‘ action and add the ‘Date‘ as input from the dynamic content.
Power Automate if array is empty
Power Automate if the array is empty
  • Now, we will add a condition action that will check whether the array is empty or not. Set the properties such as:
    • Value (first) – Insert the below expression
empty(outputs('Compose'))
  • Operator – is equal to
  • Value (second) – true
Power automate check if an array is empty
Power automate check if an array is empty
  • Now click on save and test it manually. Press the button ‘Runflow‘ to check the output. We can see on there are 4 data in the list.
Power Automate if array is empty
Power Automate if the array is empty
  • But in the 2nd and 3rd turn, the output will come as ‘true‘ as there is no data in the 2nd and 3rd items.
Check if array is empty in Power Automate
Check if an array is empty in Power Automate

This is how to check if an array is empty in Power Automate.

Power automate IF field is blank

In this example, we will see to check if a field is blank or not using Power Automate. Here we are going to use the previous Sharepoint list i.e. Faculties with some little modification. Such as:

Power automate if field is blank
Power automate if a field is blank

Now we will create a flow that will check if a field is blank or not in the above SharePoint list. To create the flow, the following steps are:

  • On Power Automate, create an instant cloud flow that will trigger the flow manually.
  • Add the ‘get items‘ action to get all the items from the Sharepoint list. Click on +New step > Get items. Provide the site address and the list name.
  • Add a condition control and set the values such as:
    • Value – Department value (from the dynamic content)
    • Operator – is equal to
    • Value – null (use as an expression)
  • In both the ‘if yes’ and ‘if no’ sections, add ‘compose‘ actions. Set a true value and a false value in each compose action.
Power Automate condition if the field is blank
Power Automate condition if the field is blank
  • Now save the flow and test it manually. When we click on ‘Run flow’ we can see the output will come as in the 2nd run.
Power automate check if field is blank
Power automate check if the field is blank

This is how to check if the field is blank in the SharePoint list using Power Automate.

Check: Power Automate Number Format

Power automate IF date is today

Here, we will see how to handle it if the date is today. For example, when a task is assigned to you in the Sharepoint list, it will check if the date is equal to the current date or today then it will create a task in the planner.

We have prepared a SharePoint list based on the task list.

Power automate if date is today
Power automate if the date is today

Now we will prepare a flow that will check on a particular time and create a task if the date is equal to the current date accordingly.

  • On Power Automate, create a scheduled cloud flow and set the repeat time as ‘1 day’. Click on ‘Create‘.
Power automate check if date is today
Power automate check if the date is today
  • Add a ‘Get items‘ action that will get all the items from the specified Sharepoint list. Click on +New step > Get items. Provide the site address and the list name.
  • Add a compose action and format the current date using the below expression.
formatDateTime(utcNow(),'yyyy-MM-dd')
power automate flow check if date is today
power automate flow to check if the date is today
  • Next, add a condition action to check if the start date is equal to the formatted current date (i.e. out of the compose action). Click on +New step > Condition. Set the value as:
    • Value – Start date (from the dynamic content)
    • Operator – is equal to
    • Value – Output of the compose action
power automate flow to check if the date is today
Power Automate flow to check if the date is today
  • If the condition matches, then it will create a task in the planner. Inside the ‘If yes’ section, click on +Add an action > create a task (under planner connector). set the group id, plan id, title, and Start date-time.
Basing a Flow on Today's Date with Power Automate
Basing a Flow on Today’s Date with Power Automate

Now the flow is ready. To run the flow, click on test it manually and press the ‘run flow’ button. We can see it will create the 2 tasks in the planner as there are 2 dates equal to the current date in the SharePoint list.

flow condition to compare if today date is equal with a date
flow condition to compare if today’s date is equal to a date

This is how to do Power automate if a date is today’s date.

Power Automate condition if date equals today

Here we will see how to check whether the date is equal to today or not. Let’s say, we have a SharePoint list based on some products orders and their delivery report like below:

power automate condition if date equals today
power automate condition if date equals today

Now we will create a flow to trigger this SharePoint list and insert a condition to check whether the order date is equal to today’s date or not. If it equals to today’s date then it will notify to the owner or a specified user about the order.

For today’s date, we have insert the expression:

formatDateTime(utcNow(),'yyyy-MM-dd')
Condition if date today is equal to date on SharePoint list
Condition if date today is equal to date on SharePoint list

Let’s run the flow manually and create a new item where the order date is as same as today’s date.

how to compare Dates in Microsoft flow
how to compare Dates in Microsoft flow

Now we can see an email is sent to the specified user to notify about the item that ordered today:

flow condition compare if today date is equal with a date on SharePoint list, if yes, send email
flow condition compare if today date is equal with a date on SharePoint list, if yes, send email

This is we can compare a date on SharePoint list whether it is today’s date or not and notify about it on Power Automate.

Read How to get manager email or name in Microsoft Flow

Power Automate condition if date is blank

Here we will see how to check whether the date column in sharepoint list is blank or not in Power Automate.

For this, we will take the SharePoint list that we have created previously i.e. SalesOrder. Now we will create a flow that will check whether the Order date is empty or not.

power automate condition if date is blank
power automate condition if date is blank

Let’s run the flow and create a new item on SharePoint list having blank date column:

Check a date field is blank or empty in MS Flow expression
Check a date field is blank or empty in MS Flow expression

As the date column is blank, we can see it will execute the if yes part.

IF function when Date is empty - Microsoft Power BI Community
IF function when Date is empty – Microsoft Power BI Community

This is a way where we can check whether the date is empty or not in Power Automate using If expression.

There is another way by using Get-items function, we can check whether the date column in SharePoint list is blank or not:

MS Flow to check Date field with NULL value in a SharePoint List
MS Flow to check Date field with NULL value in a SharePoint List

Similarly, we can see the output is coming like below:

Check if a date field is blank In Microsoft Automate
Check if a date field is blank In Microsoft Automate

As the date field in the 3rd item is empty so the condition is satisfied on 3. This is how to check if a date field is blank or not in Microsoft Automate.

Power automate if a date is less than today

Similarly, here we will see how to check if a date is less than today’s date using Power Automate. We are going to use the previous SharePoint list based on the ‘task list’.

Power automate if date is less than today
Power automate if the date is less than today

Now, we will create a flow that will notify the assignee via Outlook if the task’s start date is less than today’s date. To create the flow, the following steps are: (a little bit similar to the previous flow steps)

  • On Power Automate, create an instant cloud flow that will trigger the flow manually.
  • Add a ‘Get items’ action and provide the SharePoint site address and the list name.
  • Add a ‘condition’ control and set the value as below:
    • Value – Start Date (from the dynamic content)
    • Operator – is less than (select from the drop-down)
    • Value – Insert the below expression.
formatDateTime(utcNow(),'yyyy-MM-dd')
  • If the condition matches, then it will send an email to the assignee. Inside the ‘If yes’ section, click on +Add an action > Send an email. Set the properties using the dynamic content.
How to check if a date is less than current date in Power Automate
How to check if a date is less than the current date in Power Automate
  • Now save the flow. Test it manually. Click on the ‘run flow‘. We can see it will notify the user about the task where the start date is less than the current date.
How to compare a Date if it is less than today in Microsoft flow
How to compare a Date if it is less than today in Microsoft flow

This is how to compare a Date if it is less than today in Microsoft flow.

Read: Power Automate SharePoint Get items filter query contains is not valid

Power Automate IF expression today is Monday

Here we will see how to check whether the current day is Monday or not. To check this, we will create a flow and the following steps are:

  • On Power Automate, create an instant cloud flow and trigger it manually.
  • Then add a ‘compose‘ action using the below expression that will show the current date in day format i.e. Monday, Tuesday, etc.
formatDateTime(utcNow(),'dddd')
  • Next, we will add another compose action using the below expression that will check if the day is equal to Monday then the output will come as Monday; otherwise, it will come as the current day.
if(equals(outputs('Compose'),'Monday'),'Monday',outputs('Compose'))
Power Automate expression if today is Monday
Power Automate expression if today is Monday
  • Now, save the flow and test it manually. We can see as the current day is Wednesday according to the current date i.e. 5/11/2022, the output will come as Wednesday.
Power automate if today is Monday
Power automate if today is Monday

This is how to check if today is Monday in Power Automate.

Power Automate IF attachment name contains

Here we will see how to set conditions if the attachment contains some specific name. For example, if the attachment contains ‘.pdf‘ or ‘.txt‘ or some specific name, then it will store the file inside a document library.

To create the flow, the following steps are:

  • On Power Automate, create an automated cloud flow and select the trigger ‘When a new email arrives. Click on the create button.
  • Expand the trigger, and set it as Yes on the ‘Include attachments‘.
Power automate if attachment name contains
Power automate if the attachment name contains
  • Add a ‘Get attachment‘ action that will get the attachments from the arrived email. Click on +New step > Get attachment. Set the properties such as:
    • Message-Id– Message Id (From the dynamic content)
    • Attachment Id– Attachments attachment id (from the dynamic content)
  • It will create an ‘Apply to each’ loop that will check for each attachment inside the email.
Power Automate if the attachment name contains
Power Automate if the attachment name contains
  • Inside the ‘Apply to each‘ and under the ‘Get attachment‘ action, add a ‘Condition‘ action, and set the values such as:
    • Value – Name (from the dynamic content/)
    • Operator – contains
    • Value .pdf
  • If the condition matches, then it will go to the ‘If yes‘ section, and add a ‘Create file‘ action. Set the properties, such as:
    • Site address – specify the SharePoint site address
    • Folder path – Give the folder path of the specified document library.
    • Filename Name (from the dynamic content)
    • File content – Content Byte (from the dynamic content)
Save email attachments based on attachment name Power Automate
Save email attachments based on the attachment name Power Automate

Let’s save the flow, click on test > manually > Runflow. For testing purposes send an email to yourself with attachments.

if attachment name contains Microsoft Flow
IF the attachment name contains Microsoft Flow

We can see it will store only that file whose name contains ‘.pdf’ within the document library.

Power Automate check if the attachment name contains
Power Automate check if the attachment name contains

This is how to check Power automate if the attachment name contains.

Check: Power Automate add days to date

Power Automate IF date is greater than today

Here, we will see how to check whether the given date is greater than today’s date. To check this, let’s create a flow:

  • On Power Automate, create an instant flow that triggers the flow manually. Add a Date input where we will insert a date to check.
Power automate if date is greater than today
Power automate if the date is greater than today
  • Add a condition action, to check whether the date is greater than today’s date. Set the values such as:
    • Value (first) – Trigger date (from the dynamic content)
    • Operator – is greater than
    • Value (second) – Insert the below expression
utcNow('yyyy-MM-dd')
Power automate check if date is greater than today
Power automate check if the date is greater than today
  • Then in the both ‘If yes‘ and ‘If no‘ sections, add ‘compose‘ actions to show the true value and false value respectively like below:
Power Automate check whether the date is greater than today
Power Automate checks whether the date is greater than today
  • Now save the flow and test it manually. Insert a date to run the flow. For example – 6/18/2022. Then the output will appear like below:
Flow Condition greater than submission date
Flow Condition greater than submission date

This is how to check if a date is greater than today’s date.

Also read, Power Automate or Microsoft Flow delete all files in a folder

Power Automate IF day of the week

Here, we will see how to check whether the current date is a weekday or weekend (i.e. Sunday and Saturday) using a Power Automate. To create the flow, the following steps are:

  • On Power Automate, create an Instant cloud flow that triggers the flow manually.
  • Add a compose action using an expression that will retrieve the current DateTime according to UTC.
utcNow()
  • Again, add another compose action using the below expression that will show whether the current date is a weekend or weekday.
if(or(equals(dayOfWeek(outputs('Compose')),0),equals(dayOfWeek(outputs('Compose')),6)),'Weekend','weekdays')
Power automate if day of week
Power automate if a day of the week

Now save the flow, test it manually, and click on run flow. According to UTC, the current date is 5/11/2022 i.e. a weekday. So the output will come as ‘weekday‘.

Power Automate to check if a date is a weekday or weekend
Power Automate to check if a date is a weekday or weekend

This is how to work with Power Automate IF day of the week.

Power Automate IF cell is empty

Now we will see how to check if a cell is empty in an excel file using Power Automate. For this, we have prepared an excel date such as:

Power automate if cell is empty
Power automate if a cell is empty

Now, we will create a flow that will check whether the cell is empty or not. And, the following steps are:

  • On Power Automate, create an instant cloud flow that triggers the flow manually.
  • Next, add an action ‘List rows present in a table‘ and set the properties such as:
    • Location – Specify the location from the drop-down list.
    • Document library – Specify the document library where the file is stored.
    • File – Select the excel file name.
    • Table– Select the table name.
  • Next, add an action that will initialize a boolean variable having a true value. Click on +Add an action > Initialize a variable.
    • Name – VarIsCellEmpty
    • Type – Boolean
    • Value – true
Power Automate check if cell is empty
Power Automate check if cell is empty
  • Add a ‘Apply to each action and set the ‘Value‘ as an output of a previous step.
  • Inside this ‘apply to each‘, add a ‘condition’ control to check if the cell is empty or not. Click on +Add an action > Condition. Set the value as:
    • Value – Insert the below expression
empty(item()?['Sales in 2022'])
  • Operator – Isequalto
  • Value – true
Power Automate check if cell is blank
Power Automate checks if a cell is blank
  • If the condition matches, then it will move to the ‘If Yes’ section. So in the ‘If yes’ section, click on +Add an action > compose > Insert the variable (i.e. VarIsCellEmpty) as input.
  • Similarly, in the ‘If no’ section, click on + Add an action > Compose > Insert the below expression.
not(variables('VarIsCellEmpty'))
Create a flow if cell is empty using Power Automate
Create a flow if the cell is empty using Power Automate
  • Now we will save the flow > test it manually > Runflow. We can see the output will be true, where the cell is empty i.e. 3rd run.
Power Automate to check if a cell is empty or not in excel
Power Automate to check if a cell is empty or not in excel

This is how to do Power Automate to check if a cell is empty or not in excel.

Check out: Power Automate flow with Microsoft teams

Power automate IF file exists

Here we will see when we copy files from one library folder to another, and how to handle if the file already exists in the destination folder.

For example, we have 2 document libraries a source library (with folder) and a destination library such as:

1 – Source library(Documents)

How to handle If a file exists using flow
How to handle If a file exists using flow

2 – Destination library(Copied files)

power automate if file exists
power automate if the file exists

To create the flow, the following steps are:

  • On Power Automate, create an automated and select the trigger ‘When a file is created (properties only)‘ > click on create. Provide the destination library SharePoint site address and the library name.
Power automate flow fails if the file exists
Power Automate flow fails if the file exists
  • Add another action ‘Get files (properties only)‘ that will get the properties of the file from the specified folder or document library. Click on the + New step > Get files (properties only). Add the site address and the library name.
Power Automate if a file exists flow fails
Power Automate if a file exists flow fails
  • Next, we will add a ‘Copy file’ action that will copy the file from one library to another. Click on +New step > Copy file. Specify the properties such as:
    • Current Site Address– Specify the source SharePoint site address
    • File to Copy– Identifier (from the dynamic content of the ‘Get files’ action)
    • Destination Site Address– Specify the destination SharePoint site address.
    • Destination Folder– choose the destination folder where you want to store the files.
    • If another file is already there– Select ‘Fail this action‘ from the dropdown.
If another file is already there Power Automate
If another file is already there Power Automate

Now save the flow, test it manually, and run the flow. Upload 2 files (including existed files) in the source library.

Power Automate checks if files exists
Power Automate checks if files exist

We can see it will copy only those files that do not exist in the destination library.

Power automate if another file is already there
Power automate if another file is already there

The action will fail if there is a file that already exists in the destination library.

Power Automate action failed if the file is already exist
Power Automate action failed if the file is already exist

This is how to do Power automate if another file is already there.

Power automate IF column equals

Here we will see if the column equals a specific value or another column and then how it works within SharePoint using Power Automate.

For example, we have a SharePoint list named as ‘Orders List‘ based on order details such as Title, OrderDate, ShippedDate, Created by, and Status(single line of text).

Power Automate if column equals
Power Automate if column equals
  • Now we will create a flow that will check if both dates are equal in both the columns such as OrderDate and the ShippedDate, then it will send an email to the respective person who created that item and update the status as well. To create the flow, the following steps are:
  • On Power Automate, create an instant cloud flow that triggers the flow manually.
  • Then add a ‘Get items‘ action under the trigger. Provide the SharePoint site address and the list name.
Power automate check if column equals
Power automate check if column equals
  • Next, add a condition action to check whether the order date and the shipped date are equal or not.
Power Automate if column equals another column
Power Automate if column equals another column
  • If both columns are equal, then it will notify the respective user via Outlook. In the ‘If yes’ section, click on +Add an action > Send an email. Provide the properties such as:
    • To – Created by email
    • Subject – Specify the email’s subject
    • Body – Specify the email’s body using the dynamic contents.
Power automate if a column equals to another
Power Automate if a column equals to another
  • Also, add another action to update the status field in the SharePoint list. Click on +Add an action > Update Item. Set the site address, list name, Id, and Title. In the status field enter the value as ‘Will deliver soon‘.
Power automate flow if column equals
Power automate flow if column equals

This is how to do Power automate flow if column equals.

Read: Power Automate shared mailbox

Power Automate condition IF the attachment exists

Here, we will see how to handle if the attachment exists in the arrived email. For example, we will create a flow, that will check whether the email has attachments or not, and if the attachment is there then it will save the email in the specified SharePoint folder.

To create the flow, the following steps are:

  • On Power Automate, create an automated cloud flow that will trigger the flow when a new email arrives. On Power Automate, click on +Create > Automated cloud flow > Select the trigger ‘When a new email arrives (V3)‘ > Create.
  • In that trigger expand the Show advanced option > Include Attachments > Yes.
Power Automate if the attachment exists
Power Automate if the attachment exists
  • Add a Condition action and set the value such as:
    • Value – Has Attachments (from the dynamic content)
    • Operator – is equal to
    • Value – true
Power Automate check if attachments exist
Power Automate checks if attachments exist
  • If the email has attachments then it will move to the ‘If yes‘ section. Inside the ‘If yes‘ section, add a ‘Get attachment‘ action that will get the attachment from the email. Click on +Add an action > Get attachment. Set the message-id and attachment id from the dynamic content.
Power Automate condition if the attachment exists
Power Automate condition if the attachment exists
  • Inside the ‘Apply to each’ loop, add another action ‘Create file’ that will store the attachment in a specified SharePoint folder. Click on + Add an action > Create file. Set the properties such as:
    • Site address – Specify the SharePoint site address
    • Folder Path – Specify the folder path
    • File Name – Name (Select it from the dynamic content)
    • File Content – Content Byte (From the dynamic content)
Power Automate condition to check if the attachment exists
Power Automate condition to check if the attachment exists
  • Now save the flow and test it manually. For testing purposes, send an email with an attachment from another user-id to yourself.
Power Automate flow condition if the attachment exists
Power Automate flow condition if the attachment exists

We can see as the email has attachments, it will store the attachments in the specified document library folder:

Power Automate condition how to check if the attachment exists
Power Automate condition how to check if the attachment exists

This is how to do the Power Automate condition if the attachment exists.

Power Automate IF expression dynamic content

Now, we will see how to use the dynamic content in Power Automate IF expression. For example, we have a SharePoint list names ‘Voters list‘ based on title, age (number), and eligible (yes/no).

Power Automate If expression dynamic content
Power Automate If expression dynamic content

Now, we will create a flow that will check whether the voter is eligible for voting or not according to their age. To create the flow, the following steps are:

  • For this, we will create an automated flow that will trigger when an item is created in the SharePoint list. On Power Automate, click on + Create > Automated Cloud Flow > select the trigger ‘When an item is created‘ > Create. Provide the SharePoint site address and the list name.
  • Add a compose action and insert the below expression that will check if the voter’s age s greater than or equal to 18 then the voter is eligible for voting.
if(greaterOrEquals(triggerOutputs()?['body/Age'],18),true,false)
  • Next, add an ‘Update item‘ action that will update the ‘Eligible‘ column. Click on + New step > Update item. Provide the site address, list name, id, and title. In the ‘Eligible‘, insert the output from compose.
IF expression dynamic content using Power Automate
IF expression dynamic content using Power Automate
  • Now save the flow. Test it manually and click on run flow. Insert a new item in the SharePoint list.
Power Automate use IF expression with dynamic content
Power Automate uses IF expression with dynamic content

This is how to use IF expression with dynamic content in Power Automate.

Power Automate If expression dynamic content [Another Example]

Now we will see how to use the dynamic contents in IF condition on a Power Automate flow. For example, we have a SharePoint list that stores the students’ names, their numbers, and Grade. But we want to differentiate whether it is under grade A or grade B when we insert a dynamic number to the list.

Here is our SharePoint list:

Power Automate If expression dynamic content
Power Automate If expression dynamic content

Now we will create a flow that will automatically show the Grade of students according to their Total Numbers. Let’s say if the number is less than or equal to 50 then it is Grade B otherwise A, and the grade will automatically be updated on the SharePoint list.

Using dynamic content in expression in Flow If statement
Using dynamic content in expression in Flow If statement

It means when we insert any random number in the SharePoint list it will be updated automatically according to the Condition.

Now we will save the flow and test manually. Then we will insert data in the SharePoint list to see the result:

Using dynamic content in IF expression
Using dynamic content in IF expression

This is how to use dynamic content in Power Automate IF expression. You can Download this flow from here.

Power Automate Multiple if statement

Now we will discuss how to use the multiple if statement in Power Automate. Let’s take an example to see how it works. For example, we have a SharePoint list having students’ name, their total numbers, and Remarks.

Our requirement is when we insert the name and total number in the SharePoint list it will be sent an email with the Remarks and then the remarks will be updated in the SharePoint list.

For remarks, we have some conditions such as if the total number is greater than or equal to 85 then remarks will be ‘Excellent’. Similarly, if the total number is greater than or equal to 70 then remarks will be ‘Very Good’, if the total number is greater than or equal to 50 then the remark will be ‘Good’ otherwise it will be ‘Fail‘.

Let’s create a flow to automate this process when an item is created in the SharePoint list. Then we will add an expression (according to our requirement) on a Compose action.

if(greaterOrEquals(triggerOutputs()?['body/TotalNumber'],85),'Excellent',if(greaterOrEquals(triggerOutputs()?['body/TotalNumber'],70),'Very Good',if(greaterOrEquals(triggerOutputs()?['body/TotalNumber'],50),'Good','Fail')))
Power Automate Multiple if statement
Power Automate Multiple if statement

In the next step, we will add an action to send an email and then add another action to update the remarks in the SharePoint list.

Power Automate Multiple if expression
Power Automate Multiple if expressions

Testing the flow

Let’s take an example to test and see how its works. For example, we will insert the student’s name and his total number:

Multiple If Statements in Power Automate
Multiple If Statements in Power Automate

We can see a mail in the outlook that will notify the result of the student with remarks :

Multiple If statements Power Automate
Multiple If statements Power Automate

Now we can see the remarks will be auto-updated on the SharePoint list:

Multiple If statements Power Automate
Multiple If statements Power Automate

Similarly, we inserted some numbers with decimal, the result will come like below:

Microsoft flow multiple If statements
Microsoft flow multiple If statements

This is how multiple if expressions work on Power Automate.

Power Automate if condition is equal to string

Here we will see how a condition executes if it matches with the specified string. Let’s say, we have a lecturer’s list having a title(single-line column) and department(choice column).

Our requirement is when we select any department then it will send a notification to the respective lecture. For example, there are 3 departments such as IT, Management, and Architect. When we select IT, it will notify the respective lecture of IT. Similarly, it will notify the lectures of Management and Architect as well.

Let’s create the flow to implement this:

First, we will trigger the flow when an item is created in the SharePoint list. Then we will add a condition action to satisfy the condition like below:

Power Automate if condition is equal to string
Power Automate if the condition is equal to a string

This flow will run automatically when an item is created in the specified SharePoint list. After creating data, it will check whether the department is IT or Management, or architect. According to the condition, it will send the email where the condition will meet.

Testing

Let’s insert data in the SharePoint list where the department is ‘architect’.

 if condition is equal to string Power Automate
if condition is equal to string Power Automate

Now we can see it will notify the lecture assigned to the architect i.e. User5(a testing purpose user ID).

 if condition is equal to string Microsoft flow
if the condition is equal to string Microsoft flow

This is how to do Power Automate if a condition is equal to string.

Read Power Automate Delete all items in SharePoint list

Power Automate condition if string is empty

There is an empty() function that checks whether the input such as string, collection, a float is empty or not. Now we will see how to check a string variable is empty or null in Power Automate.

For this, here we will initialize a string variable like below:

power automate condition if string is empty
power automate condition if string is empty

Then we will use condition action using an expression, to check whether the string variable is empty or not:

empty(variables('VarString'))
Power Automate - Check String Variable is Empty or Null
Power Automate – Check String Variable is Empty or Null

The above flow will check if the expression is true i.e. if the string variable is empty then it executes the if yes. If the variable contains any value then it executes the if no parts.

Let’s test this flow and we can see as there is no value assigned in variable i.e. empty string so it executes the if yes part:

Checking if string is empty or null in MS Flow
Checking if string is empty or null in MS Flow

Similarly, we will test the flow by inserting a string value in a variable.

Flow Condition – check string is empty or not
Flow Condition – check string is empty or not

This is how to check a string variable is empty or not in Power Automate or MS flow.

Power Automate expression IF length

Now we will see how a length function works with IF expression on Power Automate. A length function is used to return the number of elements in an array or string.

Let’s take an example of an array, where it will check if the length of the array is less than 10, then it will execute the TRUE value; otherwise, it will return FALSE.

So for this, first, we will take an array variable by initializing it:

power automate if length
power automate if length

Now we will add a Condition action to check the conditions:

Power Automate if expression using Length function
Power Automate if expression using Length function

Our flow is ready now. Let’s check the output by running it:

If expression using Length function on Microsoft flow
If expression using Length function on Microsoft flow

As the length of the array is 4 and it is less than 10, so it returns the TRUE value i.e. if yes part. This is how to do Power Automate expression if length.

Power automate IF the body is empty

Here, we will see how to work with Power Automate if the body is empty. For this we will create a flow, the following steps are:

  • On Power Automate, create an instant cloud flow that triggers the flow manually.
  • Add a ‘Initialize variable’ action to initialize an array variable. Click on + New step > Initialize variable. Set the properties such as:
    • Name- VarArray
    • Type– Array
    • Value– []
  • Again add another ‘Initialize variable‘ action and initialize a boolean variable.
    • Name- IsEmpty
    • Type– Boolean
    • Value– true (use this value as an expression)
  • Next, add a condition control to check whether the variable (i.e. VarArray) is empty or not.
    • Value– Insert the below expression
empty(variables('VarArray'))
  • Operator– is equal to
  • Value– true (use as an expression)
Power Automate if body is empty
Power Automate if the body is empty
  • If the condition matches, then it will return the true value i.e. If yes; otherwise it will return the ‘If no‘ section. So in the ‘If yes‘ section, click on +Add an action > Set variable. Set the variable ‘IsEmpty‘ to be true.
  • Similarly, in the ‘If no‘ section, click on +Add an action > Set variable. Set the variable ‘IsEmpty‘ as false.
Power automate if body is empty
Power automate if the body is empty

Click on Save > Test > Manual > Runflow. We can see as the variable i.e. VarArray has a value so the output will come as false.

Power automate check if body is empty
Power automate check if the body is empty

This is how to check if the body is empty Power Automate.

Power automate IF get items is empty

Here, we will see how to handle if the ‘get items’ is empty. For example, we have prepared a SharePoint list having some random data such as:

Power Automate get items if empty
Power Automate get items if empty

Now we will create a flow that will check whether the ‘get items’ is empty or not. To create the flow the following steps are:

  • On Power Automate, create an instant cloud flow that will trigger the flow manually.
  • Under that trigger, add a ‘Get items’ action that will retrieve all the items from the SharePoint list. Click on +New step > Get items. Provide the site address and the list name. In the ‘Filter Query’, add the below query:

Note – As the list has no data in the vendor column that equals ‘Microsoft‘ that means the value is empty or null. To implement the process, we have taken a nonexistent value.

Vendor eq 'Microsoft'
Power Automate if get items empty
Power Automate if get items empty
  • Add a condition action to check whether the filter value is there or not using an expression. Click on + New step > condition. Add below condition values:
    • value – Insert the below expression
length(body('Get_items')?['value'])
  • Operator – is equal to
  • Value – 0
Power Automate if get items is empty
Power Automate if get items is empty
  • If the condition matches then it will show the true value; otherwise, it will show the false value.
  • In the ‘If yes’, add a ‘compose‘ action and give a true value such as: ‘The get items filter value is there‘.
  • Similarly, in the ‘If no’, add another ‘compose‘ action and give a false value such as: ‘The get items filter value is not there‘.
Power Automate check if get items is empty
Power Automate check if ‘get items’ is empty

Now, click on save and test the flow manually. We can see it will return a false value as there is no data that equals Microsoft in the vendor column.

if get items action is empty in Power Automate
if the get items action is empty in Power Automate

This is how to handle if the get items action is empty in Power Automate.

Power Automate if the filename contains

Here we will see how to copy a file from one library folder to another if the file name contains a specific word. For example, we have 2 SharePoint document libraries and we have to copy files from the source library to the destination library based on a condition.

According to the condition, if the file name contains ‘Power Platform‘ or ‘Power Automate‘ then it will copy that file from the source library to the destination library.

Below are the following steps to create the flow:

  • On Power Automate, create an automated cloud flow. Select the trigger ‘When a file is created in a folder‘ and click on Create. Provide the site address and the folder id (folder path).
Power Automate if file contains
Power Automate if the file contains

Note -As the file name is encoded with Base64, it will not recognize the string that we enter in the condition, and as a result, the flow might fail. So we need to store the Base64 encoding into a string variable.

  • Click on + New step > Initilize a variable. Set the properties as:
    • Name – VarFileName
    • Type – String
    • Value – x-mx-file-name-encoded
Power automate if file name contains
Power automate if file name contains
  • Add a condition control to check the file name. Click on +New step > condition and add the condition values such as:
    • Value – VarFileName
    • Operator – is equal to
    • Value – Power Automate
  • Then click on +Add > Add row > Or. Add another condition such as:
    • Value – VarFileName
    • Operator – is equal to
    • Value – Power Platform
How to get file that CONTAINS a word using Power Automate
How to get the file that CONTAINS a word using Power Automate
  • If the condition matches, then it will copy that file from the source library to the destination library. In the ‘If yes‘ section, click on +Add an action > Copy file. Set the parameters such as:
    • Current Site Address- Specify the source site address
    • File to Copy– x-ms-file-id (from the dynamic content)
    • Destination Site Address– Give the destination site address
    • Destination Folder– Specify the destination folder path where the file will be stored
    • If another file is already there– Select ‘Copy with a new name‘ from the drop-down.
Flow condition based on SharePoint file name
Flow condition based on SharePoint file name

Now save the flow. Test it manually. For testing purposes, upload some files in the source library including the specified name.

Power Automate Flow condition based on SharePoint file name
Power Automate Flow condition based on SharePoint file name

We can see it will copy only those files whose name contains ‘Power Automate‘ or ‘Power Platform‘.

Power Automate How to get file that CONTAINS a word
Power Automate How to get the file that CONTAINS a word

This is how to do Power automate if the file name contains.

Power automate IF field changed

Here, we will see how to get a notification if a field is changed in the SharePoint field using Power Automate.

For example, there is a SharePoint list based on product’s order:

Power automate if field changed
Power automate if field changed

Now, we will create a flow that will notify the user (who created that item) via outlook, if the status field changed. To create the flow, the following steps are:

  • On Power Automate, create an automated cloud flow. Select the trigger ‘When an item is created or modified, and click on create. Provide the SharePoint site address and the list name.
  • Next, add an action ‘Get changes for an item or a file (properties only)‘ that will return information about columns that have changed within a given time window. Click on +New step > Get changes for an item or a file (properties only). Set the properties such as
    • Site Address– Provide the SharePoint site address
    • List or Library Name– Select the list or library name
    • Id– Select ID from the dynamic content
    • Since– Insert the below expression that will compare the current item with the respective old version.
sub(int(triggerOutputs()?['body/{VersionNumber}']),1)
Power automate notify if field changed
Power automate notify if field changed
  • Next, add a condition action that will check whether the column or field has changed or not. Click on +New step > Condition. Set the conditional values and the operator such as:
    • Value – Has Column Changed: Status (Select this field from the dynamic content)
    • Operator – is equal to
    • Value – true (insert it as an expression)
Power automate send notification if field changed
Power automate send a notification if the 1field changed
  • If the field is changed, then it will send an email notification to the user who created the respective item. In the ‘If yes’ section, click on +Add an action > send an email. Set the properties as:
    • To – created by email (from the dynamic content)
    • Subject – specify the email’s subject
    • Body – Specify the email’s body using the dynamic content.
How to get notification if field changed in SharePoint list using Power Automate
How to get a notification if a field changed in the SharePoint list using Power Automate
  • Now, save the flow and test it manually. Let’s change the status field (in the last item) to deliver.
Microsoft flow if field changed
Microsoft flow if field changed
  • Now, we can see it will send an email notification to the user:
Power Automate how to check if a field is changed
Power Automate how to check if a field is changed

This is how to check if a field is changed in Power Automate.

Power automate check IF list is empty

Here, we will see how to check whether the list is empty or not using Power Automate. For example, there is a blank list on our SharePoint site.

Power Automate if a list is empty
Power Automate if a list is empty

Now we will create a flow that will return a true value if the list is empty otherwise it will return the false value To create the flow, the following steps are:

  • On Power Automate, create an instant cloud flow that triggers the flow manually.
  • Add a ‘Get items‘ action that will get the items from the provided SharePoint list. Click on + New step > Get items. Provides the SharePoint site address and the list name.
  • Next, Initialize a boolean variable that will store whether the list is empty or not in boolean. Click on +New step > Initialize variable. Set the properties such as:
    • Name – IsListEmpty
    • Type – Boolean
    • Value – true (used as an expression)
Power automate check if list is empty
Power automate check if a list is empty
  • Now, add a condition control action and set the values such as:
    • Value – Insert the below expression
length(outputs('Get_items')?['body/value'])
  • Operator – Is equal to
  • Value – true (use as an expression)
Power automate check if a list is empty
Power automate check if a list is empty
  • In the ‘If yes‘ section, add a ‘set variable‘ action and set the variable ‘IsListEmpty‘ as true; similarly, repeat this process in the ‘If no’ section and set the variable value as false.
How to check if list is empty Power automate
How to check if a list is empty Power automate

Now click on save > test > manual > run flow. We can see as the list has no data, so the output comes as true.

Power Automate flow to check if a list is empty
Power Automate flow to check if a list is empty

This is how to check if a list is empty using Power Automate flow.

Also, you may like the below Power Automate tutorials:

Conclusion

From the Power Automate tutorial, we discussed how to use the If expression and If condition action in Power Automate. Also, we covered below such as:

  • What is Power Automate IF expression?
  • Do an example using Power Automate IF expression.
  • How to use Power Automate If expression in the variable?
  • How to use if expression with greater than function in Power Automate?
  • How to use Power Automate IF expression with null value?
  • How to use Power Automate IF expression with boolean value?
  • How to use Power Automate IF expression with equals?
  • How to use the If condition with ‘is equal to’ in Power Automate?
  • What is Power Automate IF condition?
  • How to use Power Automate expression IF OR?
  • How to use Power Automate expression IF AND?
  • How to handle if it is approved in Power Automate condition?
  • How to use Power automate if an array ‘contains’ function?
  • How to use Power Automate IF expression with the ‘contains’ function?
  • How to handle if a person’s field is empty in Power automate?
  • How to check Power automate if the date is null?
  • How to send an email using Power Automate IF condition?
  • Power Automate checks if an input string is an integer or not?
  • How to do Power Automate condition if the field is blank?
  • How to check if the array is empty using the Power Automate condition?
  • Power automate IF date is today
  • Power automate if a date is less than today
  • Power Automate IF expression today is Monday
  • Power Automate IF attachment name contains
  • Power Automate IF date is greater than today
  • Power Automate IF day of the week
  • Power Automate IF cell is empty
  • Power automate IF file exists
  • Power automate IF column equals
  • Power Automate condition IF the attachment exists
  • Power Automate IF expression dynamic content
  • please how do i resolve this

    get items returns [] output.

    the filter query returns the correct result but the output is empty

  • >