Split text string at specific character (2024)

In this example, the goal is to split a text string at the underscore("_") character with a formula. Notice the location of theunderscore is differentin each row. This means the formula needs to locate the position of the underscore character first before any text is extracted. There are two basic approaches to solving this problem. If you are using Excel 365, the best approach is to use the TEXTBEFORE and TEXTAFTER functions. If you are using an older version of Excel without these functions, you can use a more complicated formula that combines the LEFT, RIGHT, LEN, and FIND functions. Both approaches are explained below.

Note: in the worksheet shown, we split text at the underscore character ("_"), but the solutions below can be adapted to split text at any character.

How to split text in Excel 365

The current version of Excel 365 contains three new functions that make this problem quite simple:

  • TEXTSPLIT function - splittext at all givendelimiters
  • TEXTBEFORE function - getthe text before a specific delimiter
  • TEXTAFTER function - get the text after a specific delimiter

Each option is described below. Choose the best option based on your specific needs.

TEXTSPLIT function

The TEXTSPLIT function splits text at a given delimiter and returns the split text in an array that spills onto the worksheet into multiple cells. In the worksheet shown, the formula used to split text in cell C5 is:

=TEXTSPLIT(B5,"_")

The text comes from cell B5 and the delimiter is provided as the underscore character wrapped in double quotes ("_"). The result is an array with two values like this:

{"Assessment","January 10"}

This array lands in cell C5 and spills into the range C5:D5. The result is "Assessment in cell C5 and "January 10" in cell D5. As the formula is copied down it performs the same operation on all values in column B.

Video demo: Excel TEXTSPLIT function

With TEXTBEFORE and TEXTAFTER

Another way to solve this problem is to use theTEXTBEFORE andTEXTAFTER functions separately. You can extract text on the left side of the underscore with the TEXTBEFORE function in cell C5 like this:

=TEXTBEFORE(B5,"_") // left side

As the formula is copied down, it returns the text before the underscore for each text string in B5:B16.

Video demo: Excel TEXTBEFORE function

To extract text on the right side of the underscore, use the TEXTAFTER function in cell D5 like this:

=TEXTAFTER(B5,"_") // right side

As the formula is copied down, it returns the text after the underscore for each text string in B5:B16.

Video demo: Excel TEXTAFTER function

How to split textin an older version of Excel

Older versions of Excel do not offer the TEXTSPLIT,TEXTBEFORE, or TEXTAFTER functions. However, you can still split text at a specific character with a more complex formula that combines the LEFT, RIGHT, LEN, and FIND functions.

Split text string at specific character (1)

Left side

To extract the text on the left side of the underscore, you can use a formula like this in cell C5:

LEFT(B5,FIND("_",B5)-1) // left

Working from the inside out, this formulauses the FIND function to locate the underscore character("_") in the text, then subtracts 1 to move back one character:

FIND("_",B5)-1 // returns 10

FIND returns 11, so the result after subtracting 1 is10. This result is fed into the LEFT functionas thenum_charsargument, the number of characters to extract from B5, starting from the first character on the left:

=LEFT(B5,10) // returns "Assessment"

The LEFT function returns thestring "Assessment" as thefinal result. As this formula is copied down, it will return the same results seen in column C above.

Right side

To extract text on the right side of the underscore, you can use a formula like this in cell D5:

RIGHT(B5,LEN(B5)-FIND("_",B5)) // right

As above, this formula also uses theFIND function to locate the underscore ("_") at position 11. However, in this case, we want to extract text from the right side of the string, so we need to calculate the number of characters to extract from the right. This is done by subtracting the result from FIND (11) from the total length of the text in B5 (21), which is calculated with the LEN function:

=LEN(B5)-FIND("_",B5)=21-11=10

The result is 10, which is returned to theRIGHT function as num_chars, the number of characters to extract from the right:

=RIGHT(B5,10) // returns "January 10"

The final result in D5is the string "January 10".As this formula is copied down, it will return the same results seen in column D above.

Split text string at specific character (2024)

References

Top Articles
Five or So Questions on Loading Ready Run
Superbad 2: Judd Apatow Explains His Scrapped Plans For A Sequel
Funny Roblox Id Codes 2023
Golden Abyss - Chapter 5 - Lunar_Angel
Www.paystubportal.com/7-11 Login
Joi Databas
DPhil Research - List of thesis titles
Shs Games 1V1 Lol
Evil Dead Rise Showtimes Near Massena Movieplex
Gore Videos Uncensored
Slay The Spire Red Mask
Top Hat Trailer Wiring Diagram
World History Kazwire
George The Animal Steele Gif
Red Tomatoes Farmers Market Menu
Nalley Tartar Sauce
Chile Crunch Original
Immortal Ink Waxahachie
Craigslist Free Stuff Santa Cruz
Mflwer
Spergo Net Worth 2022
Costco Gas Foster City
Obsidian Guard's Cutlass
Marvon McCray Update: Did He Pass Away Or Is He Still Alive?
Mccain Agportal
Amih Stocktwits
Fort Mccoy Fire Map
Uta Kinesiology Advising
Kcwi Tv Schedule
What Time Does Walmart Auto Center Open
Nesb Routing Number
Random Bibleizer
10 Best Places to Go and Things to Know for a Trip to the Hickory M...
Black Lion Backpack And Glider Voucher
Gopher Carts Pensacola Beach
Duke University Transcript Request
Lincoln Financial Field, section 110, row 4, home of Philadelphia Eagles, Temple Owls, page 1
Jambus - Definition, Beispiele, Merkmale, Wirkung
Netherforged Lavaproof Boots
Ark Unlock All Skins Command
Craigslist Red Wing Mn
D3 Boards
Jail View Sumter
Nancy Pazelt Obituary
Birmingham City Schools Clever Login
Thotsbook Com
Vérificateur De Billet Loto-Québec
Funkin' on the Heights
Vci Classified Paducah
Www Pig11 Net
Ty Glass Sentenced
Latest Posts
Article information

Author: Amb. Frankie Simonis

Last Updated:

Views: 6138

Rating: 4.6 / 5 (76 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Amb. Frankie Simonis

Birthday: 1998-02-19

Address: 64841 Delmar Isle, North Wiley, OR 74073

Phone: +17844167847676

Job: Forward IT Agent

Hobby: LARPing, Kitesurfing, Sewing, Digital arts, Sand art, Gardening, Dance

Introduction: My name is Amb. Frankie Simonis, I am a hilarious, enchanting, energetic, cooperative, innocent, cute, joyous person who loves writing and wants to share my knowledge and understanding with you.