Data Import & Export

Group Excel Records by Person on Separate Worksheets

Steven ParkerSteven Parker Nov 18, 2026 869 views

Question details

Automatically organize a large Excel data set so that each person's records appear on a separate worksheet.

How to Group Excel Records by Person on Separate Worksheets
Product
Microsoft Excel
Device & OS
not provided
Scenario
A person may appear in multiple rows because they teach several courses or have other related records.
Observed behavior
The desired result is one worksheet per person containing all of their corresponding rows.
Before you start

Arrange the source data with headers in row 1 and one record per row, and identify the column containing person names. Use consistent names for the same person and resolve errors in that column before grouping.

Solution 1Recommended

Use a VBA macro to create a worksheet for each person

Use this repeatable method in Excel for Windows when you need to split many records into separate worksheets automatically.

The macro creates a new workbook and groups nonblank names without changing the source sheet. It compares names without regard to capitalization and removes leading and trailing spaces.

Output tabs are named Person 1, Person 2, and so on. Each sheet contains the original header and the matching rows as values; formulas and formatting are not copied.

1
Open the source worksheet

In Excel for Windows, open the workbook and select the worksheet containing the records. Note the person column number, such as 1 for column A or 2 for column B.

2
Add a VBA module

Press Alt+F11, select Insert > Module, and paste the following code: Sub SplitRecordsByPerson() Dim src As Worksheet, dest As Worksheet, result As Workbook Dim people As Object, choice As Variant, person As String Dim lastRow As Long, lastCol As Long, personCol As Long Dim r As Long, nextRow As Long Set src = ActiveSheet lastCol = src.Cells(1, src.Columns.Count).End(xlToLeft).Column choice = Application.InputBox("Enter the person column number (A = 1):", Type:=1) If VarType(choice) = vbBoolean Then Exit Sub If choice < 1 Or choice > lastCol Or choice <> Int(choice) Then MsgBox "Enter a valid column number within the header range." Exit Sub End If personCol = CLng(choice) lastRow = src.Cells(src.Rows.Count, personCol).End(xlUp).Row If lastRow < 2 Then MsgBox "No person records were found." Exit Sub End If Set people = CreateObject("Scripting.Dictionary") people.CompareMode = 1 Set result = Workbooks.Add(xlWBATWorksheet) For r = 2 To lastRow person = Trim(CStr(src.Cells(r, personCol).Value)) If Len(person) > 0 Then If Not people.Exists(person) Then If people.Count = 0 Then Set dest = result.Worksheets(1) Else Set dest = result.Worksheets.Add(After:=result.Worksheets(result.Worksheets.Count)) End If dest.Name = "Person " & (people.Count + 1) dest.Range(dest.Cells(1, 1), dest.Cells(1, lastCol)).Value = _ src.Range(src.Cells(1, 1), src.Cells(1, lastCol)).Value people.Add person, dest End If Set dest = people.Item(person) nextRow = dest.Cells(dest.Rows.Count, personCol).End(xlUp).Row + 1 dest.Range(dest.Cells(nextRow, 1), dest.Cells(nextRow, lastCol)).Value = _ src.Range(src.Cells(r, 1), src.Cells(r, lastCol)).Value End If Next r MsgBox "Created worksheets for " & people.Count & " people." End Sub

3
Run the macro

Return to the source worksheet, press Alt+F8, select SplitRecordsByPerson, and click Run. Enter the person column number when prompted.

4
Review and save the output

Check the new workbook's Person tabs to confirm the records are grouped correctly, then select File > Save As to save the results.

Use a VBA macro to create a worksheet for each person
Running the split again: The macro creates a new output workbook each time. Rows with blank person names are skipped, and the Scripting.Dictionary used by this example is intended for Excel on Windows.
Organize records in WPS Spreadsheet

Separate records by person with WPS Spreadsheet

Open your Excel file in WPS Spreadsheet, filter the person column, and copy each person's visible records to a separate worksheet. This manual method is useful for a small number of people; it does not automatically create all sheets.

  1. 1. Open the workbook: In WPS Spreadsheet, select Open and choose the Excel file containing your records.
  2. 2. Filter the person column: Select the data range, choose Data > Filter, and use the drop-down in the person column to show one person's records.
  3. 3. Copy the matching records: Select the visible header and filtered rows, then copy them. Confirm that only the intended rows were copied.
  4. 4. Paste into a new worksheet: Click the plus button beside the worksheet tabs, select cell A1, and paste the copied records. Rename the tab to identify the person.
  5. 5. Repeat and save: Return to the source sheet, change the person filter, and repeat for each person. Select File > Save As to save the workbook.
Filter records by person and place matching rows on separate sheetsOpen and save Microsoft Excel XLSX and XLS filesUse a familiar spreadsheet interface with worksheet tabsWork with a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Can an Excel formula create a separate worksheet for each person?

No. FILTER can return a person's matching rows on an existing sheet, but it does not create worksheets. Create or copy each sheet manually, or use a macro to generate them.

Do I need LAMBDA to filter records by person?

No. In an Excel version that supports dynamic arrays, a FILTER formula can return matching rows directly. LAMBDA is optional if you want to define a reusable custom formula.

Will the VBA macro preserve formulas and formatting?

The macro shown copies cell values only. It creates a new workbook with headers and matching records, but it does not copy formulas, formatting, or column widths.

What happens if a person has several rows?

The VBA macro places all rows with the same person name on the same output sheet. It ignores capitalization and leading or trailing spaces, but different spellings are treated as different people.

Can Power Query split records by person?

Power Query can group or filter records using Data > From Table/Range, then load query results to worksheets. Creating a separate output for every person generally requires additional automation or individual queries.