Excel Formulas to Split Text by Pipe Delimiter

📅 Feb 22, 2026 📝 Sarah Miller

Manually separating pipe-delimited (|) text in Excel is a tedious, error-prone chore that derails your productivity. While standard funding sources and enterprise databases typically export clean files, raw system outputs often leave you with clustered, unreadable strings. Fortunately, modern formulas grant you seamless, automated parsing that eliminates manual data cleaning. Note this key stipulation: this streamlined approach requires Excel 365 or Excel for the Web. For example, using the formula =TEXTSPLIT(A2, "|") instantly distributes your data into clean, adjacent columns. Below, we will detail this formula's mechanics, explore nested alternatives for older versions, and walk through step-by-step implementation strategies.

Excel Formulas to Split Text by Pipe Delimiter

When working with data exports from databases, CRMs, or ERP systems like SAP and Salesforce, you will frequently encounter data delimited by a pipe character (|). A typical example looks like this: ProductA|Category1|99.99|InStock.

While Excel provides a manual "Text to Columns" wizard to split this data, a formula-based approach is far superior when you need a dynamic, automated solution. If your source data changes, formulas will instantly update the split values without requiring you to repeat manual steps. This comprehensive guide will walk you through the best Excel formulas to split data by a pipe character, ranging from the modern TEXTSPLIT function to robust legacy workarounds for older Excel versions.

Method 1: The Modern & Simple Way – TEXTSPLIT (Excel 365 & 2021+)

If you are using Microsoft 365, Excel for the Web, or Excel 2021, you have access to a game-changing text manipulation function: TEXTSPLIT. This function completely replaces the need for complex, nested string-manipulation formulas.

The Syntax

=TEXTSPLIT(text, col_delimiter, [row_delimiter], [ignore_empty], [match_mode], [pad_with])

How to Use It

To split a pipe-delimited text string in cell A2 across columns, write the following formula in cell B2:

=TEXTSPLIT(A2, "|")

Because TEXTSPLIT is a dynamic array function, you only need to type it in a single cell. Excel will automatically "spill" the split values into the adjacent columns to the right. If cell A2 contains Red|Medium|24.99, cell B2 will display Red, cell C2 will display Medium, and cell D2 will display 24.99.

Handling Empty Values

If your data contains consecutive pipe characters representing empty fields (e.g., John||Doe|Manager), you can choose how to handle them using the fourth argument, ignore_empty:

  • Keep empty cells (Default): =TEXTSPLIT(A2, "|", , FALSE) – This will leave an empty cell in your destination grid where the missing data was.
  • Skip empty cells: =TEXTSPLIT(A2, "|", , TRUE) – This will ignore the consecutive pipes and collapse the results so no empty cells appear in the output.

Method 2: The Classic Workaround (Excel 2019, 2016, and Older)

For users on older versions of Excel that do not support dynamic array formulas like TEXTSPLIT, you must use a combination of classic string functions: TRIM, MID, SUBSTITUTE, REPT, and LEN.

This formula works by temporarily replacing every pipe character with a massive block of spaces, extracting the relevant block, and then trimming away the excess spaces. It is a highly clever and reliable workaround.

The Legacy Formula

Enter the following formula in cell B2 and copy it across the columns to the right, and then down your table:

=TRIM(MID(SUBSTITUTE($A2, "|", REPT(" ", LEN($A2))), (COLUMN(A1)-1)*LEN($A2)+1, LEN($A2)))

How This Legacy Formula Works

While this formula looks intimidating at first glance, it is easy to understand when broken down step-by-step:

  1. LEN($A2): Calculates the total character length of the original string. Let's assume the string length is 20 characters.
  2. REPT(" ", LEN($A2)): Generates a string of spaces equal to the length of the original text. In this case, it creates a block of 20 spaces.
  3. SUBSTITUTE($A2, "|", REPT(...)): Replaces every pipe character (|) with that block of 20 spaces. The text is now incredibly wide, with distinct "islands" of actual data separated by huge oceans of spaces.
  4. COLUMN(A1): Returns the column number of cell A1, which is 1. As you drag this formula to the right, COLUMN(A1) dynamically changes to COLUMN(B1) (which is 2), then COLUMN(C1) (which is 3), and so on.
  5. (COLUMN(A1)-1)*LEN($A2)+1: This mathematical expression calculates the starting position for the MID function. For the first column, it calculates (1-1)*20+1 = 1. For the second column, it calculates (2-1)*20+1 = 21. This ensures the formula jumps directly to the correct "island" of text.
  6. MID(..., [Start], [Length]): Extracts 20 characters starting from the calculated position. Because of the vast spacing we introduced, this extraction is guaranteed to grab our target word along with a lot of surrounding spaces.
  7. TRIM(...): This is the cleanup step. It strips away all the leading and trailing spaces, leaving only the clean, split data.

Method 3: Extracting Specific Parts of Pipe-Delimited Data

Sometimes you don't want to split the entire string across multiple columns. Instead, you might only want to extract a specific portion of the pipe-delimited data-for instance, just the first item, or just the last item.

Extracting the First Item

To pull out only the text before the very first pipe character, you can use a simple combination of LEFT and FIND:

=LEFT(A2, FIND("|", A2) - 1)

Note: This formula will return an error if there is no pipe character in the cell. To prevent this, wrap it in an IFERROR statement:

=IFERROR(LEFT(A2, FIND("|", A2) - 1), A2)

Extracting the Last Item

Extracting the last item in a variable-length list is trickier. If you are on Excel 365, you can use TEXTAFTER to easily pull everything after the last pipe. If you have legacy Excel, you can use this combination of RIGHT, LEN, SUBSTITUTE, and FIND:

=TRIM(RIGHT(SUBSTITUTE(A2, "|", REPT(" ", LEN(A2))), LEN(A2)))

Formula Comparison Matrix

To help you decide which method to use for your specific dataset, consult the table below:

Formula Method Excel Compatibility Pros Cons
TEXTSPLIT Office 365, Excel 2021+ Incredibly simple; handles empty elements easily; automatically spills across cells. Does not work on older Excel versions.
TRIM/MID/SUBSTITUTE All Excel Versions Highly compatible; works on legacy workbooks; no VBA required. Complex formula; must be manually dragged across cells; hard to troubleshoot.
LEFT/FIND All Excel Versions Lightweight; very fast processing on large datasets. Only extracts the first element.

Advanced Tip: What About Numbers and Dates?

When you split data using text formulas, Excel treats the output as text strings. If your pipe-delimited string contains numbers or dates (such as Widget|2023-11-01|14.99), Excel might not recognize the split outputs as actual dates or numbers. This means you won't be able to sum them or format them properly.

To fix this, you can force Excel to convert numeric text back into numbers by adding a double unary operator (double minus sign --) or multiplying by 1. For example:

=--TEXTSPLIT(A2, "|")

Alternatively, if you are using the legacy TRIM method, wrap the formula in VALUE():

=VALUE(TRIM(MID(SUBSTITUTE($A2, "|", REPT(" ", LEN($A2))), (COLUMN(A1)-1)*LEN($A2)+1, LEN($A2))))

Warning: Ensure the target extracted cell only contains numeric or date data before applying these modifiers, as text values will return a #VALUE! error.

Summary

Splitting pipe-delimited data in Excel no longer requires repetitive manual labor or complex VBA macros. For modern Excel users, TEXTSPLIT offers an elegant, single-cell solution. For those maintaining legacy worksheets, the classic TRIM(MID(SUBSTITUTE(...))) technique provides backward compatibility across all Excel platforms. Choose the method that best matches your Excel version and data structure to streamline your workflows today.

Disclaimer:
The documents and templates provided on this page are for informational and illustrative purposes only. They do not constitute professional, legal, or financial advice, and should not be relied upon as such. Because individual circumstances and regulatory requirements vary, these materials may not be suitable for your specific needs. We recommend consulting with a qualified professional before adapting or using any of these examples for official or commercial purposes.