How To Split Excel Sheet into Multiple Worksheets

Table of Contents

Table of Contents

You can split your Excel sheet into multiple worksheets depending on a specific data value. It can keep your large and related information organized and simplify your workflow in Excel.

Key Takeaways

โžค Worksheet splitting means separating data into multiple sheets based on one specific value.
โžค PivotTable: Insert >> PivotTable >> Add filter >> Analyze tab >> Show Report Filter Pages >> OK.
โžค VBA: Developer tab >> Visual Basic >> Insert >> Module >> Writer script >> Run via Macros.
โžค Manual: Manually copy & paste data or use Power Query.

overview image

In this article, we will learn three methods to split one Excel sheet into multiple worksheets โ€” one using PivotTable, the other with VBA Script, and last of all, manually.


What Does It Mean to Split an Excel Sheet into Multiple Worksheets?

Splitting a worksheet in Excel into multiple worksheets means dividing a large data sheet into separate sheets based on specific criteria of the given data. We can do so by both column value and row value. It makes it easier to manage or analyze data grouped in categories.

In the following dataset, we have feedback data from multiple customers. First, we are going to split the sheet based on the Customer column, each one will get their own worksheet.


1

Split the Excel Sheet into Multiple Worksheets Using PivotTable

PivotTable can quickly divide your data into separate sheets using a report filter. Follow the steps below.

โžค Head over to Insert >> Then PivotTable.

Split the Excel Sheet into Multiple Worksheets using PivotTable

โžค Select a table range. We are okay with the table range. We are just going to make a new sheet. Click on OK.

Note:
Click inside your data first. Then go to Insert >> PivotTable, and Excel should auto-select the correct range.

Split the Excel Sheet into Multiple Worksheets using PivotTable

โžค PivotTable Fields will appear. As we are working with the Customer column here, it is important to select and put the Customer as our filter.

Split the Excel Sheet into Multiple Worksheets using PivotTable

โžค We can extract the relevant data to COLUMN, ROWS, or VALUES as you prefer. Here weโ€™ve selected Satisfaction Score and Feedback Types as rows. This is what it looks like.

Split the Excel Sheet into Multiple Worksheets using PivotTable

โžค Now move to the Analyze tab >> Head to the Options section.
โžค Click on the drop-down menu and select Show Report Filter Pages.

Split the Excel Sheet into Multiple Worksheets using PivotTable

โžค In the pop-up, we want to select Customer as our filter. Click Ok.

Now you will notice that it has automatically generated three different sheets for each of our three customers.

Split the Excel Sheet into Multiple Worksheets using PivotTable

The best part is that it is fully customizable. Letโ€™s say you want to see by satisfaction score or feedback type, just drag the option as the filter and do the exact same action.


2

Split an Excel Sheet Based on Column using VBA Script

We have the same table as before, and weโ€™ll split the data by Customer once again using VBA code.

โžค Go to the Developer tab >> Visual Basic

Split an Excel Sheet into Multiple Worksheets Based on Column using VBA Script

Note:
If you donโ€™t see the Developer tab, itโ€™s probably deactivated. Go File >> Options >> Customize Ribbon and tick the Developer tab.

Split an Excel Sheet into Multiple Worksheets Based on Column using VBA Script

โžค Selectย  Insert from the menu bar >> Click on Module.

Split an Excel Sheet into Multiple Worksheets Based on Column using VBA Script

โžค In the module, you will need to write the following VBA code to split the sheets.
You can just copy the code and paste it into the module.

Sub SplitDataBySelectedColumn()
ย ย ย  Dim ws As Worksheet
ย ย ย  Dim wsNew As Worksheet
ย ย ย  Dim rng As Range
ย ย ย  Dim lastRow As Long
ย ย ย  Dim lastCol As Long
ย ย ย  Dim uniqueValues As Collection
ย ย ย  Dim cell As Range
ย ย ย  Dim value As Variant
ย ย ย  Dim colToFilter As Long
ย ย ย  Dim columnHeader As String
ย ย ย  Dim headerFound As Boolean
ย ย ย  Dim i As Long
ย ย ย  Dim sanitizedValue As String
ย ย ย  ' Use the active worksheet
ย  ย ย Set ws = ActiveSheet
ย ย ย  lastRow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row
ย ย ย  lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column
ย ย ย  Set rng = ws.Range(ws.Cells(1, 1), ws.Cells(lastRow, lastCol))
ย ย ย  ' Prompt the user to select the column header
ย ย ย  columnHeader = InputBox("Enter the column header to split the data by (case-insensitive):")
ย ย ย  If columnHeader = "" Then
ย ย ย ย ย ย ย  MsgBox "No column header entered. Exiting.", vbExclamation
ย ย ย ย ย ย ย  Exit Sub
ย ย ย  End If
ย ย ย  ' Find the column based on header value (case-insensitive)
ย ย ย  headerFound = False
ย ย ย  For colToFilter = 1 To lastCol
ย ย ย ย ย ย ย  If LCase(ws.Cells(1, colToFilter).Value) = LCase(columnHeader) Then
ย ย ย ย ย ย ย  ย ย ย  headerFound = True
ย ย ย ย ย ย ย  ย ย ย  Exit For
ย ย ย ย ย ย ย  End If
ย ย ย  Next colToFilter
ย ย ย  If Not headerFound Then
ย ย ย ย ย ย ย  MsgBox "Column header not found. Please try again.", vbExclamation
ย ย ย ย ย ย ย  Exit Sub
ย ย ย  End If
ย ย ย  ' Create a collection of unique values in the selected column
ย ย ย  Set uniqueValues = New Collection
ย ย ย  On Error Resume Next
ย ย ย  For Each cell In ws.Range(ws.Cells(2, colToFilter), ws.Cells(lastRow, colToFilter))
ย ย ย ย ย ย ย  uniqueValues.Add cell.Value, CStr(cell.Value)
ย ย ย  Next cell
ย ย ย  On Error GoTo 0
ย ย ย  ' Loop through unique values and create a new worksheet for each
ย ย ย  For Each value In uniqueValues
ย ย ย ย ย ย ย  ' Sanitize value for worksheet name
ย ย ย ย ย ย ย  sanitizedValue = Replace(CStr(value), "/", "_")
ย ย  ย ย ย ย ย sanitizedValue = Replace(sanitizedValue, "\", "_")
ย ย ย ย ย ย ย  sanitizedValue = Replace(sanitizedValue, "*", "_")
ย ย ย ย ย ย ย  sanitizedValue = Replace(sanitizedValue, "[", "_")
ย ย ย ย ย ย ย  sanitizedValue = Replace(sanitizedValue, "]", "_")
ย ย ย ย ย ย ย  sanitizedValue = Left(sanitizedValue, 31) ' Truncate to 31 characters if needed
ย ย ย ย ย ย ย  ' Check if the sheet name is valid and unique
ย ย ย ย ย ย ย  On Error Resume Next
ย ย ย ย ย ย ย  Set wsNew = ThisWorkbook.Sheets(sanitizedValue)
ย ย ย ย ย ย ย  On Error GoTo 0
ย ย ย ย ย ย ย  If wsNew Is Nothing Then
ย ย ย ย ย ย ย  ย ย ย  ' Add a new worksheet and name it after the sanitized unique value
ย ย ย ย ย ย ย  ย ย ย  Set wsNew = ThisWorkbook.Sheets.Add(After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count))
ย ย ย ย ย ย ย  ย ย ย  wsNew.Name = sanitizedValue
ย ย ย ย ย ย ย  Else
ย ย ย ย ย ย ย  ย ย ย  Set wsNew = Nothing
ย ย ย ย ย ย ย  ย ย ย  GoTo NextValue
ย ย ย ย ย ย ย  End If
ย ย ย ย ย ย ย  ' Copy the headers
ย ย ย ย ย ย ย  ws.Rows(1).Copy Destination:=wsNew.Rows(1)
ย ย ย ย ย ย ย  ' Copy matching rows directly without filtering
ย ย ย ย ย ย ย  i = 2 ' Start pasting from row 2 in the new sheet
ย ย ย ย ย ย ย  For Each cell In ws.Range(ws.Cells(2, colToFilter), ws.Cells(lastRow, colToFilter))
ย ย ย ย ย ย ย  ย ย ย  If cell.Value = value Then
ย ย ย ย ย ย ย ย ย ย ย  cell.EntireRow.Copy wsNew.Rows(i)
ย ย ย ย ย ย ย ย ย ย ย  i = i + 1
ย ย ย ย ย ย ย  ย ย ย  End If
ย ย ย ย ย ย ย  Next cell
NextValue:
ย ย ย ย ย ย ย  Set wsNew = Nothing
ย ย ย  Next value
End Sub

โžค Close the VBA editor now and go back to your worksheet.
โžค Next, select Macros. Select the specific Macro and run it.

Split an Excel Sheet into Multiple Worksheets Based on Column using VBA Script

It will automatically create three new worksheets. Have a look at the result in the hands-on example below.

Split an Excel Sheet into Multiple Worksheets Based on Column using VBA Script


3

Split Excel Sheet Into Multiple Worksheets Based On Rows Using VBA Script

As an alternative, now we will split sheets based on rows. For this, in the same worksheet, we have reduced the number of rows to 10.

โžค Go to Developer tab >> Visual Basic >> Insert >> Click on Module.
โžค In the module, write the script and close it.

Split Excel Sheet Into Multiple Worksheets Based On Rows Using VBA Script

We have added the following script.

Sub SplitExcelSheetIntoMultipleSheetsBasedRow()
Dim WorkRng As Range
Dim xRow As Range
Dim SplitRow As Integer
Dim xWs As Worksheet
On Error Resume Next
EcelTitleId = "Split Row Numt"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", ExcelTitleId, WorkRng.Address, Type:=8)
SplitRow = Application.InputBox("Split Row Num", ExcelTitleId, 4, Type:=1)
Set xWs = WorkRng.Parent
Set xRow = WorkRng.Rows(1)
Application.ScreenUpdating = False
For i = 1 To WorkRng.Rows.Count Step SplitRow
resizeCount = SplitRow
If (WorkRng.Rows.Count - xRow.Row + 1) < SplitRow Then resizeCount = WorkRng.Rows.Count - xRow.Row + 1
xRow.Resize(resizeCount).Copy
Application.Worksheets.Add after:=Application.Worksheets(Application.Worksheets.Count)
Application.ActiveSheet.Range("A1").PasteSpecial
Set xRow = xRow.Offset(SplitRow)
Next
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub

โžค Then again, we will return to Macros. Select the specific macro and run it.

Split Excel Sheet Into Multiple Worksheets Based On Rows Using VBA Script

โžค You will be asked to select a range. For our sheet, we have selected A1:E11 [Column A to E, Row 1 to Row 11].

Split Excel Sheet Into Multiple Worksheets Based On Rows Using VBA Script

โžค Specify the Row number to split by. We have selected four, and Macro has returned to three new worksheets.

Split Excel Sheet Into Multiple Worksheets Based On Rows Using VBA Script


4

VBA Script To Split an Excel Sheet into Multiple Files

Now we are going to split the Excel sheet into multiple files with the help of a VBA script.

โžค Go to Developer tab >> Visual Basic >>
โžค Move to Insert >> Click on Module.
โžค In the module, write the VBA script.

VBA Script To Split an Excel Sheet into Multiple Files

We have used this script. You can just copy and paste it.

Sub SplitSheetIntoMultipleWorkbooksBasedOnColumn()
Dim objWorksheet As Excel.Worksheet
Dim nLastRow, nRow, nNextRow As Integer
Dim strColumnValue As String
Dim objDictionary As Object
Dim varColumnValues As Variant
Dim varColumnValue As Variant
Dim objExcelWorkbook As Excel.Workbook
Dim objSheet As Excel.Worksheet
Set objWorksheet = ActiveSheet
nLastRow = objWorksheet.Range("A" & objWorksheet.Rows.Count).End(xlUp).Row
Set objDictionary = CreateObject("Scripting.Dictionary")
For nRow = 2 To nLastRow
strColumnValue = objWorksheet.Range("A" & nRow).Value
If objDictionary.Exists(strColumnValue) = False Then
objDictionary.Add strColumnValue, 1
End If
Next
varColumnValues = objDictionary.Keys
For i = LBound(varColumnValues) To UBound(varColumnValues)
varColumnValue = varColumnValues(i)
Set objExcelWorkbook = Excel.Application.Workbooks.Add
Set objSheet = objExcelWorkbook.Sheets(1)
objSheet.Name = objWorksheet.Name
objWorksheet.Rows(1).EntireRow.Copy
objSheet.Activate
objSheet.Range("A1").Select
objSheet.Paste
For nRow = 2 To nLastRow
If CStr(objWorksheet.Range("A" & nRow).Value) = CStr(varColumnValue) Then
objWorksheet.Rows(nRow).EntireRow.Copy
nNextRow = objSheet.Range("A" & objWorksheet.Rows.Count).End(xlUp).Row + 1
objSheet.Range("A" & nNextRow).Select
objSheet.Paste
objSheet.Columns("A:F").AutoFit
End If
Next
Next
End Sub

โžค Return to Macros. Select the specific macro and run it.

VBA Script To Split an Excel Sheet into Multiple Files

โžค It will split the worksheet into three different files based on column value.

VBA Script To Split an Excel Sheet into Multiple Files


5

Split Excel Sheets Into Multiple Worksheets Manually

Both processes for splitting the worksheet mentioned above are quite actionable. As for VBA, one downside is that you may need a little technical knowledge, although you can use our script and tweak it according to your project needs.

However, if you are not comfortable with VBA, you can follow one of the two ways.

  • Either copy and paste the data manually into the new sheets
  • Or, split it while importing the data into Excel (e.g., using Power Query).

Splitting sheets manually is both slow and tedious, especially with larger ones. In such cases, relying on VBA or PivotTable will be far more efficient.

Note:
The Power Query feature is only available in Microsoft 2013 and above versions. If you are not in the category, you have to complete the task using VBA.


6

Split Excel Sheet By Using Power Query

Now we will split the datasheet into multiple worksheets based on the Customer column value using Power Query. Follow the steps below.

โžค Select your table or data range.
โžค Go to the Data menu >> Select From Table option

Split Excel Sheet By Using Power Query

โžค Confirm My table has headers and click OK.

Split Excel Sheet By Using Power Query

โžค Our data is loaded in Power Query.

Split Excel Sheet By Using Power Query

โžค So, now we will duplicate the file. On the left side of the Power Query Editor, select the Table >> Give a right click >> Select Duplicate.

We will have another table. Weโ€™ve duplicated two tables for our two customers this time.

Split Excel Sheet By Using Power Query

โžค We have two different tables for our two different customers.
โžค Now we are just going to rename the Tables. On the right side, under Query Settings, rename based on the data you want to split in the Name field. We have done so based on our customer’s name.

Split Excel Sheet By Using Power Query

โžค Go into each Table >> Click Filter option.
โžค Choose the name and click OK.
โžค Leave the table as it is and go to the next table. Do the same.

Split Excel Sheet By Using Power Query

โžค Click on Close & Load >> Select Close & Load.

Split Excel Sheet By Using Power Query

โžค On the Excel sheet, you will see data has been filtered into different sheets.

Split Excel Sheet By Using Power Query


Downloadable Resources

Get our practice workbook or necessary files that we have worked with to prepare this article.

Split Excel Sheet into Multiple Worksheets.xlsx


Frequently Asked Questions

How do I split an Excel sheet into two pages?

  • Go to the View tab >> Click Page Break Preview
  • Select the row below where you want the page break to occur.
  • Go to the Page Layout tab >> Click Breaks
  • Select Insert Page Break.

How can I convert multiple individual spreadsheets into one tab on one spreadsheet?

  • Open a new blank Excel worksheet
  • Click on the Data >> Get Data in the Get & Transform Data section
  • Choose From File >> From Workbook. Browse and select your files.
  • Select the sheet you want to import in the Navigator window >> Click Load.
  • Repeat the steps for each file.

How do you group sheets in Excel?

Press and hold the  Ctrl  key >> Click on the sheet tabs you want to group. Press and hold the  Shift  key to group consecutive sheets.

How do I copy data from one Excel sheet to multiple sheets?

  • Select the data on the sheet by pressing  Ctrl  +  C .
  • Add new worksheets using the plus sign.
  • Select the cells in the new worksheet. Press  Ctrl  +  V  to paste all the data.

How do you split data in an Excel sheet?

  • Go to the Data >> Select Data Tools >> Then Text to Columns
  • Select the delimiter to define the place where you want to split the data in the sheet
  • Select Apply

Wrapping Up

In this quick tutorial, we have learned the steps to split an Excel sheet into multiple worksheets using three methods. Feel free to download the practice file and let us know which method works out best!

Facebook
X
LinkedIn
WhatsApp
Picture of Nighat Hossain

Nighat Hossain

Nighat Hossain holds a BSc in Computer Science and Engineering and has 4+ years of practical Excel and Google Sheets experience. She specializes in VBA automation, formulas, data cleaning, report preparation & template creation. She enjoys simplifying Excel workflows and creating easy-to-follow guides for users.
We will be happy to hear your thoughts

      Leave a reply


      Excel Insider
      Logo