How to Remove Items From a Power Apps Collection (Remove, RemoveIf and Clear)

Collections are where I keep temporary data in a canvas app: a shopping cart, the items a user checked in a gallery, or rows I’m about to save. Sooner or later, you need to take things out again, one item, a few that match a condition, or everything.

In this tutorial, I’ll show you nine ways to remove items from a Power Apps collection with Remove, RemoveIf and Clear, and the mistakes that leave items behind or delete data you meant to keep.

Quick answer: Use Remove(colProducts, ThisItem) on a button inside a gallery to remove that item, RemoveIf(colProducts, Category = "Laptop") to remove every item that matches a condition, and Clear(colProducts) to remove all items. These functions only work in behavior properties like OnSelect.

Remove, RemoveIf and Clear at a glance

FunctionRemovesExample
Remove(collection, record)One specific recordRemove(colCapital, ThisItem)
Remove(collection, table)Every record in the tableRemove(colProducts, Filter(colProducts, Price < 50))
RemoveIf(collection, condition)Every record where the condition is trueRemoveIf(colProducts, Category = "Mouse")
Clear(collection)All recordsClear(colProducts)

Remove needs the whole record to match, so it’s best when you already have the record, like ThisItem. RemoveIf is best when you know a rule. If collections are new to you, start with the Power Apps collection guide.

The sample collections

For the first examples, a button creates a collection of countries and capitals. I use ClearCollect rather than Collect, because Collect adds the same rows again every time you select the button:

ClearCollect(
    colCapital,
    {Country: "USA", Capital: "Washington"},
    {Country: "United Kingdom", Capital: "London"},
    {Country: "Vietnam", Capital: "Hanoi"},
    {Country: "Thailand", Capital: "Bangkok"},
    {Country: "Spain", Capital: "Madrid"},
    {Country: "Ukraine", Capital: "Kyiv"}
)
Create Collection button and a gallery of countries and capitals in Power Apps

For the later examples, I use a small product collection with prices in USD:

ClearCollect(
    colProducts,
    {ID: 1, Title: "Lenovo IdeaPad 5", Category: "Laptop", Manufacturer: "Lenovo", Price: 749},
    {ID: 2, Title: "MacBook Air 13", Category: "Laptop", Manufacturer: "Apple", Price: 1099},
    {ID: 3, Title: "Surface Laptop 7", Category: "Laptop", Manufacturer: "Microsoft", Price: 999},
    {ID: 4, Title: "Magic Mouse", Category: "Mouse", Manufacturer: "Apple", Price: 79},
    {ID: 5, Title: "ThinkPad Mouse", Category: "Mouse", Manufacturer: "Lenovo", Price: 29},
    {ID: 6, Title: "iPad Air", Category: "Tablet", Manufacturer: "Apple", Price: 599}
)

Example 1: Remove one item from a gallery

Add a gallery with Items set to colCapital, and insert a trash can icon in the gallery template:

Gallery bound to the colCapital collection with a delete icon on each row

Set the icon’s OnSelect to:

Remove(colCapital, ThisItem)
Remove function with ThisItem in the delete icon's OnSelect

Select the trash can next to Washington, and that row disappears:

Gallery after one item was removed from the collection

If the gallery has check boxes too, see Power Apps checkbox in a gallery for select-all and reset patterns.

Example 2: Remove all items

Add a Clear All button with this OnSelect:

Clear(colCapital)
Clear function on the Clear All button in Power Apps

Every row is removed, but the collection still exists, so you can add to it again:

Empty gallery after the collection was cleared

RemoveIf(colCapital, true) does the same thing. Clear only works on collections, not on data sources like SharePoint lists.

Example 3: Remove the first or last item

Remove(colProducts, First(colProducts))
Remove(colProducts, Last(colProducts))

To remove the first three, pass a table instead of a record: Remove(colProducts, FirstN(colProducts, 3)). If you sorted the gallery but not the collection, sort the collection first so “first” means what users see. See how to sort a Power Apps collection.

Example 4: Remove items that match a condition

To remove every laptop, use RemoveIf:

RemoveIf(colProducts, Category = "Laptop")

You can combine conditions with And and Or, or list several conditions, which RemoveIf treats as all required:

RemoveIf(colProducts, Manufacturer = "Apple" Or "Mouse" in Title)
RemoveIf(colProducts, Category = "Laptop", Price > 900)

The second line removes only laptops over $900. To check whether something is in a collection before you remove it, see Power Apps collection contains.

Example 5: Remove items chosen in a dropdown

Add a dropdown named drpManufacturer with Items Distinct(colProducts, Manufacturer), and a button with this OnSelect:

RemoveIf(colProducts, Manufacturer = drpManufacturer.Selected.Value)

Pick Lenovo and select the button, and both Lenovo products are gone. To filter instead of remove, see how to filter a Power Apps collection.

Example 6: Remove an item by ID

If the collection has an ID column, either of these removes item 5:

RemoveIf(colProducts, ID = 5)
Remove(colProducts, LookUp(colProducts, ID = 5))

If you filled the collection from a SharePoint list with ClearCollect(colProjects, Projects), remember that it only loads the first 500 rows (up to 2,000 with the data row limit). An ID beyond that isn’t in the collection at all. See how to create a collection from a SharePoint list.

Example 7: Remove an item when a check box is cleared

To keep a collection of the items a user checked in a gallery, set the check box’s OnCheck and OnUncheck:

OnCheck:   Collect(colSelected, ThisItem)
OnUncheck: Remove(colSelected, ThisItem)

Remove finds the record because ThisItem is exactly the record that was added. If a user can add the same item twice, add RemoveFlags.All to remove every copy: Remove(colSelected, ThisItem, RemoveFlags.All).

Example 8: Remove blank rows

Rows with empty values often sneak in from forms or imports. Remove them with IsBlank:

RemoveIf(colCapital, IsBlank(Country) Or IsBlank(Capital))

An older version of this post compared the values with a single space, Country = " ", which misses truly empty values. IsBlank catches both empty strings and blanks.

Example 9: Remove columns instead of rows

Sometimes “remove” means a column. ShowColumns keeps only the columns you list, and DropColumns removes the ones you list. Column names are written without quotes:

ClearCollect(colNames, ShowColumns(colProducts, Title, Price))
ClearCollect(colNoPrice, DropColumns(colProducts, Price))
Collection with Product, Manufacture and Quantity columns in Power Apps
Collection after removing columns with ShowColumns in Power Apps

Older examples put the column names in quotes, like "Price". That syntax was replaced in 2024.

Removing from a collection vs a SharePoint list

Remove and RemoveIf also work on data sources, but there they delete records permanently. RemoveIf('Product Model', Title = "Dell XPS 13") deletes the item from SharePoint, not just from your collection.

For SharePoint, RemoveIf only delegates conditions on number columns. With a text condition, Power Apps fetches up to 500 or 2,000 rows and deletes the matches one by one, so items further down the list are left. See how to fix Power Apps delegation warnings.

Troubleshooting

  • Remove does nothing: the record you pass doesn’t match exactly, for example because one column changed. Use RemoveIf with an ID.
  • Items come back: a Collect on a button or OnVisible adds them again. Use ClearCollect.
  • Only one copy is removed: add RemoveFlags.All.
  • Error in a property like Items: these functions only work in behavior formulas such as OnSelect.

These collection tutorials go well with this one:

Frequently Asked Questions

How do I remove an item from a collection in Power Apps?

Use Remove(collection, ThisItem) in a gallery, or RemoveIf(collection, condition). Microsoft documents both in its Remove and RemoveIf reference.

How do I clear a whole collection?

Use Clear(collection). The collection stays, but it has no rows. ClearCollect clears it and adds new rows in one step.

What’s the difference between Remove and RemoveIf?

Remove deletes specific records you pass to it. RemoveIf deletes every record where a condition is true.

Does RemoveIf delete items from SharePoint?

Yes, when you use it on the SharePoint list instead of a collection. It deletes them permanently, so test with a collection first.