Power Query Problems

How to Generate Unique IDs from Item Names and Frequencies in Excel

Adam DavisAdam Davis Nov 13, 2026 869 views

Question details

The user needs to expand a two-column table of item names and frequency counts into repeated rows and generate sequential unique identifiers such as Bob_01, Chris_01 through Chris_05, and John_01 through John_02.

How to Generate Unique IDs from Item Names and Frequencies in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
The user has a table containing item names and desired frequency counts and wants to create one row per required occurrence with unique IDs.
Observed behavior
The expected output is an expanded item list with repeated item names and unique identifiers based on the frequency column.
Before you start

Store the source data in an Excel table with clear Item Name and Frequency columns. Check that item names are not blank and all frequency values are positive numbers before expanding the rows.

Solution 1Recommended

Expand Item Names by Frequency and Add Sequential IDs with Power Query

Use this when your workbook has Power Query and you want a refreshable, formula-free solution.

Power Query lets you create a list of sequence numbers for each frequency value, expand that list into rows, and then concatenate the item name with a zero-padded sequence.

1
Load the source table into Power Query

Click any cell in the source table, go to the Data tab, and choose From Table/Range. Confirm the table range to open the Power Query Editor.

2
Create a sequence list for each frequency

In Power Query, go to Add Column > Custom Column. Name it Sequence and enter = List.Numbers(1, [Frequency]) to create a list from 1 to the frequency value for each item.

3
Expand the sequence list to new rows

Click the expand icon in the Sequence column header, choose Expand to New Rows, and each item will repeat according to its Frequency value.

4
Add the two-digit unique ID column

Go to Add Column > Custom Column. Name it Unique ID and enter = [Name] & "_" & Text.PadStart(Text.From([Sequence]),2,"0") to return IDs such as Bob_01 and Chris_03.

5
Load the result to Excel

On the Home tab, click Close & Load, choose Table, and select a new worksheet as the destination.

Expand Item Names by Frequency and Add Sequential IDs with Power Query
Refreshable result: After changing the source table, right-click the query result and choose Refresh to update all expanded IDs.
Free Microsoft Office alternative

Need an Excel-Compatible Spreadsheet? Try WPS Office Free

Power Query is a Microsoft Excel feature, and WPS Office does not include the native Power Query editor. WPS Spreadsheet is a free, lightweight alternative that opens .xlsx workbooks, keeps a familiar ribbon interface, and lets you edit and save Excel data without losing formatting or formulas.

  1. 1. Download WPS Office Free: Visit the WPS Office download page and click Download WPS Office Free to install the suite on your device.
  2. 2. Open the Excel workbook: Launch WPS Spreadsheet, click Open, and select the .xlsx file that contains the item names and frequency table.
  3. 3. Review and save the data: Use the familiar ribbon tools to review or edit the expanded list, then save the file as .xlsx to preserve Excel compatibility.
Free office suite with spreadsheet, writer, and presentation toolsOpens, edits, and saves .xlsx files with Microsoft Excel format compatibilityFamiliar Office-style ribbon makes migration from Excel straightforwardLightweight and fast for cleaning and preparing data tablesIncludes PDF conversion and cloud storage for sharing generated ID lists
QA img-9

Frequently Asked Questions

Can I generate two-digit IDs like Bob_01 instead of Bob_1 in Power Query?

Yes. In the custom column, use Text.PadStart on the sequence number, for example: [Name] & "_" & Text.PadStart(Text.From([Sequence]),2,"0").

What should I do if my frequency column contains zero or blank values?

Check the frequency column before expanding. Zero or blank values can create empty lists or unexpected rows; filter them out or replace them with 1 as needed.

Will the REDUCE, SEQUENCE, VSTACK, and HSTACK formulas work in WPS Spreadsheet?

These dynamic array functions are designed for Microsoft 365. WPS Spreadsheet can open and edit the workbook, but the Power Query method or a helper-column approach may be required outside Microsoft 365.

How do I refresh the generated IDs after changing the source table?

If you used Power Query, right-click the result table and choose Refresh, or open Power Query Editor and click Close & Load again after changing the source.

Can I place the expanded result in the same worksheet as the source table?

Yes. When closing and loading Power Query results, choose Table and select the same worksheet, but ensure the destination area does not overlap the original table.