How to split strings in Excel
In Excel when working with character strings, there are many cases where it is necessary to split a string to use the data, but the amount of data needs to be separated quite large, if merely manually doing it takes a lot of time and effort. strength. The following article shows you how to split strings in Excel.
Some functions to use when splitting a string:
- Left: The function takes the substring to the left of the original string
- Right: The function takes the substring to the right of the original string
- Mid: The function takes the substring in the middle of the original string
Syntax:
- LEFT (text, [num_char])
- RIGHT (text, [num_char])
- MID (text, start_num, num_char)
Inside:
+ text: The original string containing the string to be cut
+ num_char: number of characters to cut.
+ start_num: position to start retrieving the substring.
There are several ways to separate a string:
- Use the function to cut left, right, and mid strings combined with the replacement feature in Excel.
- Use the function left, right, mid,…. Combine a number of search functions to determine position in Excel.
In 2 examples below give detailed instructions to you how to split strings in Excel many practical applications today.
Example 1: Separate a first and last name field into 3 separate fields: first, middle, and middle names
Step 1: Copy the entire column data and first name to the first column :
Step 2: Highlight all the data in the Name column -> press Ctrl + H to enter the following content:
- Find what section: enter the characters '*' and spaces.
- Section Replace with: Leave blank
Click Replace all to replace all characters before the space with white space:
Step 3: A dialog box appears has been replaced, click OK:
Result obtained from the first and last name column:
Step 4: Get the first and last values from the first and last name column by entering the formula: = LEFT (C6, LEN (C6) -LEN (G6) -1)
Pressing Enter results:
Step 5: Copy the entire column they just got pasted into the middle name column, note that in the process of pasting into the column name, then right-click and choose paste according to the value type as shown:
Step 6: Do the same as the column name to get the middle name value by using replace feature in Excel:
Result of the middle name from the last column:
Step 7: Get the value for the last column.
- Create 1 column next to the Last column in the cell to get the value they enter the formula: = LEFT (E6, LEN (E6) -LEN (G6) -1)
Press Enter -> copy the formula for the remaining values to result:
Step 8: Copy and paste the column value of the last column again by the value -> delete the last outermost column (note if not copying and pasting the value type for the Last column column when deleting the extra column). error)
As a result, you have separated 3 surname, middle name and first name from the first and last column column. This is a quick and easy way to save time and effort when separating your first and last name:
Example 2: From the value when importing materials to split the string of characters into 2 parts of product name and origin.
- In this article, when importing materials, including the name of supplies and origin separated by dashes. To perform a split sequence use the Left and Right functions. However, because each item has a different name and length, it is not known in advance the number of characters to be taken in the Left and Right functions:
- Because in all input values including supplies name and origin are separated by dashes based on dashes to determine the number of characters to be taken for the Left and Right functions by using the Find function.
How to separate the product name and product origin follow these steps:
Step 1: In the cell to get the product name enter the formula: = LEFT (C6, FIND ('-', C6) -1)
Step 2: Press Enter to get the product name from the imported supplies:
Step 3: Copy the formula for the remaining values:
Step 4: In the box you need to get the origin of the input material: = RIGHT (C6, LEN (C6) -FIND ('-', C6))
Step 5: Press Enter -> copy the formula for the remaining values to result:
So, with simple steps, you can separate the product name and origin from the imported supplies code:
The above is a detailed guide on how to split strings in Excel based on specific examples. Good luck!
You should read it
- String (String) in PHP
- String (String) in C / C ++
- The use of the Split tool separates the Excel data table
- string.h in C
- The function takes a string in Excel
- How to split columns in Excel
- How to split 1 cell into 2 cells in Excel - Split cells in Excel
- The LEFT function, how to use the left-hand string cutting function in Excel
May be interested
- How to calculate the average in Excelthe following article guides you in detail how to calculate the average in excel. there are 2 ways to calculate the average value: - calculate the average value according to the usual calculation formula. - calculate the average value using the average function.
- Calculation of age from date of birth in Excelthe following article will guide you how to calculate the age from date of birth in excel so you can calculate the exact number of standard age in years, months and days. in the process of calculating age based on date of birth, the following cases occur: - case 1: calculates the usual age
- Convert commas to dots in Excelby default, the number format in excel follows international standards separating thousands with commas and decimals as dots. this way of writing is in contrast to the vietnamese writing style, so this article i will guide how to change commas
- How to paginate pages from any page in Word 2016the following article details how to number pages from any page in word 2016. normally when selecting page numbering, word default page numbering starts from the first page in the text.
- How to turn off, turn on Enable Editing when opening Word, Excelinstructions to turn off, turn on enable editing or protected view mode when opening word and excel files. when you download a word or excel file online, word and excel usually ask you to turn off protected view by clicking enable editing.
- Numbering in Excel 2016numbering in excel is a great feature that excel supports to help users work effectively and reach the fastest speed. the following article provides detailed instructions for numbering in excel 2016.