Excel: Combine Invoice and Payment Rows into One Row
Question details
The user needs to transform repeating invoice and payment records into one row for each record.
- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- The source data has a consistent number of values per invoice and payment record, and the user wants to flatten the rows into a single-row layout.
- Observed behavior
- Invoice and payment values are distributed across repeating rows instead of appearing together in one output row.
Confirm how many values belong to each output record and whether empty cells should be removed or preserved. Select a blank area outside the source range for the transformed results.
Use TOROW and WRAPROWS to combine consistent invoice and payment rows
Use this formula-based method when every record contains the same number of values and the source layout is predictable.
TOROW converts the source range into one row, while WRAPROWS places the values into new rows after a specified number of items. The ignore-blanks argument can remove empty cells when the source contains gaps.
In Excel, click an empty cell where the first combined record should appear, such as F1.
Enter =WRAPROWS(TOROW(A1:D6,1),6) and press Enter. Replace A1:D6 with your source range and replace 6 with the number of values required for each output row.
Review the dynamic array results below and to the right of the formula cell. Each group of six values is placed on one output row, with blank cells ignored.
If blank cells are meaningful, remove the ignore argument and use a formula such as =WRAPROWS(TOROW(A1:D6),6). Set the wrap count to the full number of cells in each record.
Use Power Query for larger or irregular invoice and payment data
Choose Power Query when the source contains many rows, inconsistent spacing, or repeatable cleanup steps that should be refreshed later.
Combine Invoice and Payment Records in WPS Spreadsheet
Use WPS Spreadsheet's Excel-compatible dynamic array formulas to flatten a consistent source range and wrap the values into one row per invoice and payment record. Adjust the source range and wrap count to match your layout.
- 1. Open the workbook in WPS Spreadsheet: Launch WPS Office, open the XLSX workbook, and select an empty cell beside or below the source data.
- 2. Enter the row-combining formula: Type =WRAPROWS(TOROW(A1:D6,1),6) in the selected cell, replacing A1:D6 with your data range and 6 with the values per record.
- 3. Preserve or remove blanks: Keep the 1 argument in TOROW to ignore blank cells, or remove it when blank positions must remain part of each record.
- 4. Review and save the output: Check that each invoice and payment record occupies one row, then use Menu > Save As to save the result as an XLSX file if needed.

Frequently Asked Questions
What does the 6 in WRAPROWS mean?
It is the number of values placed in each output row. Change 6 to the number of fields that make up one complete invoice and payment record.
How do I keep empty cells in the original positions?
Use TOROW without the ignore-blanks argument, for example =WRAPROWS(TOROW(A1:D6),6). The wrap count must include every cell position in a record.
Why are my invoice and payment values misaligned after using the formula?
The wrap count may not match the actual number of values per record, or ignored blank cells may be changing the sequence. Verify the record width and decide whether blanks should be preserved.
Can I use this method when each record has a different number of values?
TOROW and WRAPROWS are best for consistent structures. For irregular data, use Excel's Data > From Table/Range command and reshape the source with Power Query.
Can the combined results update when the source data changes?
Yes. A TOROW and WRAPROWS formula recalculates when its referenced range changes. Expand the source range or use an Excel table if new records will be added regularly.




