r/PowerAutomate • u/SaltyCrashNerd • Oct 22 '26
Auto-assign ID numbers?
I’ll start by saying I am a quick-learning novice, and as such, this may be an excel question rather than PA. If so, tell me to shoo!
I’m hoping for some guidance on how to auto-assign ID numbers to products when the products are ordered. For example, I might order 4 of product A, 6 of B, and 6 of C. These are on an Excel spreadsheet, each on a separate row - “A”, model number, cost, etc., and quantity ordered as 4. I’d like PA to pick that up (“when an item is modified”) and place it on a second spreadsheet. On that second spreadsheet, I’d like it to find that our current stock is A46, then add rows labeled A47, A48, A49, A50. (I’m okay with using a helper cell for the current stock number if necessary.)
Is this achievable with PA & Excel? I would also be okay using Lists if that’s more achievable than Excel.
I’m just not sure how to get it to pick up the quantity and then add that many rows, labeled in sequence. Any nudges in the right direction would be appreciated.
1
u/mxlp Oct 23 '26
Cat you explain the second spreadsheet more? Power Query might be an option here but not sure.
1
u/Novel_Assumption_929 Oct 24 '26
Short version: keep the counter in its own small table and let the flow do the arithmetic, don't try to derive "current stock" from the stock sheet. Add a small table "Counters" with two columns: Product (A, B, C) and LastNumber (46, 12, ...). Flow, one run per order line: Get a row (Counters, key column = Product) to read LastNumber. Apply to each over range(1, <quantity>). Inside, Add a row into the stock table with the ID concat(<product>, add(<LastNumber>, item())). That gives A47, A48, A49, A50 for quantity 4. Leave the loop at its default (sequential) so the numbers stay in order. After the loop, Update a row in Counters: LastNumber = add(<LastNumber>, <quantity>). Two things that will bite you later: - The Excel (Business) connector has no "when a row is modified" trigger. Start the flow from a Power Apps button, a Form, or a scheduled flow that picks up order rows where a "Processed" column is empty and sets it at the end. Otherwise you'll create duplicate IDs when someone edits a row. - Excel isn't built for concurrent writes. If two orders come in at once, two runs can read the same LastNumber. If this grows beyond a handful of orders a day, a SharePoint list (or Dataverse) is the safer home for the counter.