web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Simple Increment Value...
Power Apps
Answered

Simple Increment Value in SharePoint List in Power apps

(1) ShareShare
ReportReport
Posted on by 395
I am wanting to increment a simple ID Value in a SharePoint List each time a value is created. Is there a simple way to do thing in power apps formula? Or in Power Automate. If so, how would that be done.
 
This what I would like it to look like:
CAR-01
CAR-02
........
CAR-100
........
Car-1000
 
I also would like the IDs to be unique, so it can't repeat if a value is deleted. 
Categories:
I have the same question (0)
  • Verified answer
    Nandit Profile Picture
    1,568 Moderator on at
    Hi Trout19,
     
    One way to solve this issue is - combining the built-in ID column with "Car-". After creating the new item, get the id of the last item created and patch the CARID column with "CAR-" and the item's ID.
    //Write the following code after your code for creating a new item (Patch / SubmitForm)
    
    Patch(
        SPList,
        First(SortByColumns( SPList,"Created", SortOrder.Descending)),
        {
            CARID: "CAR-" & First(SortByColumns( SPList,"Created", SortOrder.Descending)).ID
                       
        }
    )
     
    If you just want to increment the previous ID. Here's how you can achieve it. You will need to
    1. get the CAR ID of the last item created,
    2. split it by "-" so we can the value at the end
    3. add 1 to it to create the new CAR ID for the new item.
    This doesn't address your second requirement of not repeating values. If you deleted the item "CAR-04", the formula will treat "CAR-03" as the last item and then create "CAR-04" again instead of creating "CAR-05". Please give it a try and see if it helps:
    Patch(
        SPList,
        Defaults(SPList),
        {
            CARID: "CAR-" & Value(
                Last(
                    Split(
                        First(
                            SortByColumns(
                                SPList,
                                "Created",
                                SortOrder.Descending
                            )
                        ).CARID,
                        "-"
                    )
                ).Value
            ) + 1
        }
    )
     
     
    Hope this helps. 
     
    Kind regards, 
    Nandit
     
    If this answers your query, please mark this response as the answer.
    If its helpful, please leave a like. Thanks!
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 421

#2
Valantis Profile Picture

Valantis 405

#3
timl Profile Picture

timl 337 Super User 2026 Season 1

Last 30 days Overall leaderboard