Are you facing any difficulties in incrementing a number in the Power Apps gallery? No need to worry! This Power Apps tutorial will teach how to increment number in the Power Apps gallery with a simple example.
Increment Number in Power Apps Gallery
Here, we will discuss how to increment a Text Box number values into your Gallery when you click on the “Button” control.
For example, In Power Apps, there are some records in the gallery like Input Details-1, Input Details-2, Input Details-3, Input Details-4, Input Details-5, and so on. Next, When a user deletes one item from the gallery suppose Details-3, the next item will be replaced in the deleted item place.
Refer to the below gif to understand better.
To work around this example, follow the below steps. Such as:
1. Open Power Apps with your respective Microsoft credentials -> Create Power Apps Blank Canvas app -> Select Power Apps Screen -> Insert a Text input control, a Button input [Add] and set Its OnSelect property as:
OnSelect = Collect(
InputCollection,
{
Name: "Input Details-" & CountRows(InputCollection) + 1,
TextBoxValue: txt_IncrementValues
}
)
Where,
- InputCollection = Power Apps collection name
- Name, TextBoxValue = Header of the collection
- CountRows = This function helps to count the total number of items or records in a gallery control.
- txt_IncrementValues = Text input control name

2. Next, insert the Gallery control and apply the collection on its Items property as:
Items = InputCollection

3. Then, within the gallery, insert a Trash icon to help delete the item. Apply the below code on the OnSelect property of the Trash icon:
OnSelect = Remove(
InputCollection,
ThisItem
);
Clear(colIncrementNumber);
ForAll(
InputCollection,
Collect(
colIncrementNumber,
{
Name: "Details-" & CountRows(colIncrementNumber) + 1,
TextBoxValue: txt_IncrementValues
}
)
);
ClearCollect(
InputCollection,
colIncrementNumber
)
Where,
- InputCollection = Power Apps source collection name
- colIncrementNumber = This is a new collection name

4. Once it is done, Save, Publish, and Preview the app. When a user adds any value from the text input control and clicks on the button control, it will increment the number in the gallery control as in the below screenshot.

This is how to work with the increment number in the Power Apps gallery.
Conclusion
From this Power Apps tutorial, we learned in detail information about how to increment a number in the Power Apps gallery with a simple example.
You may like:
- How to Sort Power Apps Gallery Alphabetically?
- How to Add Attachments in Power Apps Gallery?
- How to Delete SharePoint List Item from Power Apps Gallery?
- Delete SharePoint List Item from Power Apps Gallery
- Show Message If Gallery is Empty in Power Apps

Hey! I’m Bijay Kumar, founder of SPGuides.com and a Microsoft Business Applications MVP (Power Automate, Power Apps). I launched this site in 2020 because I truly enjoy working with SharePoint, Power Platform, and SharePoint Framework (SPFx), and wanted to share that passion through step-by-step tutorials, guides, and training videos. My mission is to help you learn these technologies so you can utilize SharePoint, enhance productivity, and potentially build business solutions along the way.
