How to Split a String by Character in Excel (4 Useful Methods)

Table of Contents

Table of Contents

When you are analyzing usernames, cleaning up mixed data entries, or preparing text for further processing, you need to break down a string character by character. You can split a string character by character by using the built-in formulas like MID and TEXTSPLIT, to features like Power Query, Flash Fill, and even VBA. In this article, weโ€™ll explore all the methods step by step to split a string by character in Excel.

Key Takeaways

To split a string by character using the MID and COLUMN functions, follow these steps.

โžค Click on the cell B2, Write this formula:
=MID($A2,COLUMN()-1,1)
โžค First, drag the formula across 8 columns and then drag down. You will get all the split strings by character.

overview image

In this article, we will explore four methods to split a string by character in Excel. Combiningย  MID with COLUMN functions, using the TEXTSPLIT Function, using Power Query and VBA Macro for One-Click Splitting.


1

Combining MID with COLUMN Function

By using the combination of the MID and COLUMN functions, we can extract each character from a string into separate cells. The MID function is used to return a specific character from a text string, while the COLUMN function helps to select the position of each character dynamically.

In the following dataset, we have mixed characters of data to be split into characters.

Steps:

โžค Click on the cell B2, Write this formula:

=MID($A2,COLUMN()-1,1)

Combining MID with COLUMN Function

โžค First, drag the formula across 8 columns and then drag down. You will get all the split strings by character.

Combining MID with COLUMN Function


2

Using TEXTSPLIT Function

The TEXTSPLITย  is a dynamic array function that can instantly break a text string into separate characters. To split by every character, the TEXTSPLIT function uses an empty string (“”) as the delimiter to split each character as an individual item. It automatically updates when the source data changes.

Steps:

โžค Click on the cell B2, Write this formula:

=TEXTSPLIT(TEXTJOIN(",",,MID(A2,SEQUENCE(LEN(A2)),1)),",")

Using TEXTSPLIT Function

โžค Drag the formula across 8 columns and then drag to the right.

Using TEXTSPLIT Function


3

Using Power Query

Power Query is a powerful data transformation tool to split a string into individual characters. After loading the data into Power Query, it converts each string into a list of characters and then sets the characters into a separate sheet.

Steps:

โžค Select column A and then click Data > From Table/Range.

Using Power Query

โžค In Power Query Editor: Select the column, click Home > Split Column > By Number of Characters.

Using Power Query

โžค In the number of character box, click โ€œ1โ€ and choose โ€œRepeatedlyโ€ and then click OK.

Using Power Query

โžค Click Close & Load to return the split characters.

Using Power Query

โžค Now you can see the split characters in a different sheet.

Using Power Query


4

VBA Macro for One-Click Splitting

A VBA macro is ideal for large or repetitive datasets. A macro can split each character of a string into separate columns. You need to assign the macro to a button. After clicking that button, strings will be split by character.

Steps:

โžค Press  Alt  +  F11 ย to open the VBA Code Editor, and then click Insert > Module.

VBA Macro for One-Click Splitting

โžค Paste the code.

Sub SplitCharacters()
ย ย ย  Dim cell As Range
ย ย ย  Dim i As Integer
ย ย ย  For Each cell In Selection
ย ย ย ย ย ย ย  For i = 1 To Len(cell.Value)
ย ย ย ย ย ย ย ย ย ย ย  cell.Offset(0, i).Value = Mid(cell.Value, i, 1)
ย ย ย ย ย ย ย  Next i
ย ย ย  Next cell
End Sub

VBA Macro for One-Click Splitting

โžค Select the data. Press  Alt  +  F8 ย to open the Macro window, select SplitCharacters and then click Run.

VBA Macro for One-Click Splitting

โžค After running the macro, you can see the string is split by character.


Downloadable Resources

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

Split a String by Character.xlsx


Frequently Asked Questions

How can I split only a part of the string?

By using the MID function, you can split only a part of the string.

How many characters are allowed to be split in Excel?

Up to 32,767 characters are allowed by Excel. So you can split characters up to this limit. Otherwise, you can face layout or performance problems.

Does the original data change when characters are separated?

When characters are split, the original data will not change unless it is deleted by hand.

Why is the TEXTSPLIT function not working in my Excel?

The TEXTSPLIT function will not work in any older version of Excel. TEXTSPLIT is only available in Excel 365 and Excel 2021.

Is it possible to remove empty columns or characters after splitting?

Yes, by using the FILTER function, you can remove empty columns or characters after splitting. You can use the โ€œRemove Columnsโ€ or โ€œFilter Rowsโ€ options when you are using the Power Query option. You can add conditions in the macro to skip blanks when you are applying VBA.


Wrapping Up

In this article, we have discussed four distinct methods step by step for splitting a string by character in Excel. Feel free to download the practice file and share your thoughts and suggestions in the comment box.

Facebook
X
LinkedIn
WhatsApp
Picture of Nusrat Jahan

Nusrat Jahan

Nusrat Jahan holds a BSc in Computer Science & Engineering from North South University and has 4+ years of Excel and Google Sheets experience. She specializes in data analysis, visualization, formulas, PivotTables, charts, data cleaning, validation, and IMPORTRANGE. She enjoys creating habit trackers, budget planners, and project management sheets, using formulas, conditional formatting, and interactive tools to simplify task organization and financial planning.
We will be happy to hear your thoughts

      Leave a reply


      Excel Insider
      Logo