Convert Multiple Serial Number Rows into One Row by Asset Tag in Excel
Question details
Convert repeated asset tag and serial number records into one row per asset tag, with each serial number placed in its own column.

- Product
- Microsoft Excel 365
- Device & OS
- not provided
- Scenario
- A worksheet contains a Tag column and an SN column, and the user needs a consolidated export with columns such as S/N 1, S/N 2, and S/N 3.
- Observed behavior
- Multiple source rows share the same asset tag, while the required result has one asset tag row with all related serial numbers arranged across columns.
Make sure the source has consistent headers such as Tag and SN, and remove or filter rows with blank asset tags. If you use a formula, adjust the source range or convert the data to an Excel table before entering it.
Use a dynamic-array formula to reshape serial numbers into columns
Use this method in Excel 365 when you need a live result that updates as the source records change.
The formula creates a unique list of asset tags, counts the serial numbers for each tag, pads shorter groups with blanks, and uses WRAPROWS to return one row per asset. It assumes the Tag values are in the first column and there are no blank records inside the selected range.
Place asset tags in column A and serial numbers in column B, with headers in A1 and B1. Update the A2:B5001 range in the formula to match your data range.
Select an empty cell, such as D1, then enter: =LET(data,A2:B5001,id,INDEX(data,,1),keyId,SORT(UNIQUE(id)),recordCount,COUNTIF(id,keyId),maxCount,MAX(recordCount),newRows,maxCount-recordCount,cols,SEQUENCE(,maxCount),header,HSTACK("ID","S/N "&cols),results,HSTACK(keyId,WRAPROWS(DROP(SORT(VSTACK(data,EXPAND(TOCOL(IFS(newRows>=cols,keyId),2),,2,""))),,1),maxCount)),VSTACK(header,results))
Press Enter and allow the formula to spill into adjacent cells. The first column lists each unique asset tag, and the following columns contain S/N 1, S/N 2, and subsequent serial numbers.

Use Power Query for repeatable large data imports
Use Power Query when you regularly import thousands of records and want to refresh the one-row-per-asset result without maintaining a worksheet formula.
Manage Asset Tag and Serial Number Tables with WPS Office
WPS Office is a free, lightweight office suite with a familiar spreadsheet interface for organizing asset inventories, sorting records, and preparing import-ready tables. Its familiar layout helps you move from Microsoft Office with minimal adjustment while maintaining common workbook formats.

Frequently Asked Questions
Can I combine serial numbers into one row without Power Query?
Yes. In Excel 365, use a dynamic-array formula with functions such as UNIQUE, COUNTIF, HSTACK, VSTACK, and WRAPROWS to create one row for every asset tag.
Why should blank asset tags be removed before grouping?
Blank tags are treated as another group. Filter them out first with Data > Filter, or remove them in Power Query with a step such as Table.SelectRows that excludes null Tag values.
Will the formula add more S/N columns when an asset has additional serial numbers?
Yes. The formula calculates the maximum number of serial numbers associated with any asset tag and spills enough S/N columns to accommodate that largest group.
How do I update the Power Query output after adding new records?
Add the records to the source Excel table, then choose Data > Refresh All. Power Query reruns the grouping and split steps using the updated table data.
What if a serial number contains a comma?
Do not use a comma as the Power Query split delimiter. Edit the query to use a delimiter that cannot occur in serial numbers, or use an index-and-pivot transformation instead.




