How to Check If an Array Contains Value in Power Automate? [3 Various Ways]

Suppose you are in the middle of creating a Power Automate flow, and you need to check whether an array contains a specific value. Sounds simple, right? But looking into it, you find multiple ways to achieve this.

After some research and testing, I found three effective methods to check if an array contains a specific value:

  • Using the Power Automate contains() function.
  • Using the Filter array action in Power Automate.
  • Using the Filter array action for exact matches in Power Automate.

In this tutorial, I will explain each of these methods step-by-step and provide examples so you can choose the one that best fits your scenario.

Check If an Array Contains Value in Power Automate

I will explain how to use Power Automate to check if an array contains a specific value. Power Automate offers multiple ways to achieve this, such as using the contains() function or the “Filter Array” action.

Check If an Array Contains Value Using the Power Automate Contains() Function

Imagine you are automating a process for a company’s inventory system. You have a SharePoint list called Inventory with a Product Name column that tracks available products. You want to check if a specific product, say, Laptop, exists in the array of product names retrieved from the list. If it does, you’ll send an email notification to the inventory manager.

Check If an Array Contains Value Using the  Power Automate Contains() Function

Now, follow the below steps:

1. Open the Power Automate Home page and choose Instant cloud flow with the trigger. Manually trigger a flow. Click on +Add an Input to add text inputs (Product) to allow users to enter manually.

How to select specific values from an array in Power Automate

2. Then add a Get items action and provide the below parameter:

  • Site Address: Select the site address where the Inventory SharePoint list is present.
  • List Name: Choose the Inventory list from the drop-down.
How to check if an Array contains values in Power Automate

3. Search for Initialize variable and add it. Then provide the below parameters:

  • Name: ProductArray
  • Type: Array
  • Value: Leave blank for now (I will append it later).
Power Automate check if array contains value

4. Search for Append to array variable and add it, then provide the below parameter:

  • Name: ProductArray
  • Value: Select ProductName from the dynamic content (from Get items).

This step will automatically wrap in a For each loop because Get items returns multiple items.

power automate check if array contains specific value

5. Search for Compose, add it, and provide the below expression:

contains(variables('ProductArray'), triggerBody()?['text'])
power automate condition check if array contains value

6. Search for Condition and add it and provide the below:

  • First box: Select the output of the Compose action from dynamic content.
  • Operator: is equal to
  • Second box: true.
Check if an Array Contains a Specific Value in Power Automate

7. In the True branch, add an action: Send an email (V2) (Outlook connector) and provide the required parameter:

  • To: Enter the inventory manager’s email.
  • Subject: Product Found in Inventory
  • Body: The product ‘Laptop’ is available in the inventory.
Power Automate Contains() Function Check If an Array Contains Value Using the

Save the flow. Click Test -> Manually and run it -> Enter Product Name in the input fields.

Power Automate Contains() Function Check If an Array Contains Value

Click Run flow and wait for execution. After the flow runs successfully, the inventory manager will receive the email below.

Power Automate Contains() Function

Check if Array Contains a Specific Value with the Filter Action using Power Automate

For example, you have a manually triggered flow where you input a simple array of colors (e.g., [“Red”, “Blue”, “Green”]). You want to check if the array contains the value “Blue” using the “Filter Array” action. To do this follow the below steps:

1. Go to Power Automate. Create an Instant cloud flow with a Manually trigger a flow trigger.

power automate filter array

2. Add Initialize variable action and provide the below required parameter:

  • Name: ColorArray
  • Type: Array
  • Value: [“Red”, “Blue”, “Green”]
how to get value from filter array  power automate

3. Add Filter array action and provide the below parameter:

  • From: variables(‘ColorArray’)
  • Condition: item() “is equal to” Blue.
power automate filter array variable

4. Add a Condition Action and provide the below:

  • Left side: length(body(‘Filter_array’)) (use the “Expression” tab).
  • Operator: is greater than.
  • Right side: 0
power automate filter array multiple conditions

5. In the true section, add a compose prover the value as Blue is in the array. In the same way, in the False section, add a Compose action and provide the value as Blue is not in the array.

Check if Array Contains a Specific Value with the Filter Action using Power Automate

Save and run the flow. After the flow runs successfully, you can see the true part will run.

Check if Array Contains a Specific Value with the Filter Action in Power Automate

Check if the Array Contains Match Value with the Filter Action in Power Automate

Suppose you are tracking customer feedback submissions stored as an array of comments ([“Great service”, “Needs improvement”, “Love the product”]). You want to check if any comment contains the word “service” using the “Condition” action and output a result.

To do this, follow the below steps:

1. Go to Power Automate, select Create, select Instant cloud flow, name it (Check Feedback Comments), choose Manually trigger a flow as the trigger, and click Create.

power automate filter array

2. Add Initialize variable action and provide the below required parameter:

  • Name: FeedbackComments
  • Type: Array
  • Value: [“Great service”, “Needs improvement”, “Love the product”]
Power Automate Check if the Array Contains Match Value with the Filter Action

3. Add Filter array action and provide below parameter:

  • From: @{variables(‘FeedbackComments’)}
  • Condition: item() “contains” service.
Check if the Array Contains Match Value with the Filter Action using Power Automate

4. Add a Condition Action and provide the below:

  • Left side: length(body(‘Filter_array’)) (use the “Expression” tab).
  • Operator: is greater than.
  • Right side: 0
power automate filter array multiple conditions

5. In the true section, add a compose prover the value as Feedback contains ‘service’. In the same way, in the False section, add a Compose action and provide the value as Feedback does not contain ‘service’.

Check if the Array Contains Match Value with the Filter Action in Power Automate

Save and run the flow. After the flow runs successfully, you can see the true part will run.

How to Check If an Array Contains Value Using Power Automate

Conclusion

In this tutorial, I covered three methods for checking if an array contains a specific value in Power Automate. First, I explained how to use the contains() function to check if an item exists in an array, with an example of verifying product availability in an inventory system.

Next, I explained how to use the Filter array action to find an exact match within an array, using a color list as an example. Finally, I showed how to use the Filter array action to check for partial matches in an array, with a customer feedback scenario looking for specific keywords.

Moreover, you may like some more Power Apps tutorials:

Power Apps functions free pdf

30 Power Apps Functions

This free guide walks you through the 30 most-used Power Apps functions with real business examples, exact syntax, and results you can see.

Download User registration canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App