Microsoft Excel PART Function – Extract Data from a Cell
Excel has a whole range of wonderful features. In this post, we'll show you how to split data in a cell and cut it out!
- Published
- Content reviewed
Listen to this article
Start reading aloud with a voice from your device. Changing the voice, speed or section stops playback; you can then start again.
Checking available voices.
Overview
Have you ever had a large amount of data in an Excel file that you needed to sort? Or have you ever had to work with a worksheet where the data you need is mixed in with other data in the same cell?
To neatly separate data contained in a single cell, you can use the Excel PART function. This function can neatly split the data in a cell and distribute it across multiple cells.
Whenever you want to sort, filter, or count data by different categories, this feature is super handy.
Here's how the TEIL function is structured
One use case for TEIL is, for example, when you've pasted a large number of files—say, from accounting records—into Excel and want to split them into individual components.
You can insert the file names in Excel using the CELL function; we also have a tutorial on that.
For example, if you want to extract product numbers, you can extract the category if it always appears in a fixed position within the product number. Something similar is also possible when dealing with, for example, call numbers in libraries, ISBN numbers, etc.
The TEIL function looks like this:
=PART(text; first_character; number_of_characters)
The "Text" field specifies the source from which the characters are to be extracted. Here, you select the cells from which you want to extract parts and place them in another cell.
First_Character: This value must be a number and must be at least 1. The number specifies the character in the cell at which the text should be split.
Number_of_Characters: Starting from the left, exactly the number of characters you specify here will be extracted from the cell.
For example:
=PART(A1;8;6)
For a product number such as "98913 889933," this function outputs the numbers 889933.
If you've entered the function correctly, you can then select the cell and left-click on the small green square in the lower-right corner of the cell's border to expand it so that all product numbers are converted.
How can the TEIL function be used effectively?
The SUBTOTAL function is very useful in and of itself, but its use is limited. That's because as soon as you have entries of different lengths in a cell, the function reaches its limits.
Now you can combine the SUB function with the LEN function, for example. This allows you to extract varying numbers of letters and digits to the left of your defined value, even if they appear in the middle of the text.
An error has crept into this table from the accounting records. Not only did the accounting program fail to generate the .csv file correctly, but it also used different date formats.
If a cell were formatted correctly, only the PART function would work. However, if, for example, the wrong date format were used, the result would be incorrect. To ensure that the data is formatted correctly again, it must be extracted using the PART and LENGTH functions.
The example here is the entry
"Working Document 12/22/2019 559"
To combine the SUB and LEN functions, start by following the same steps as for the SUB function. To tell Excel which characters in a cell to ignore, instruct Excel to return only the characters “22.12.2019.” These are all the characters to the left of character 16 and to the right of character 26. Now, based on the total number of characters in the cell (30), Excel knows that only the characters following “Arbeitsmaterial”and“559” should be displayed.
This also works when the number of characters varies. For example, Excel can also handle the cell
Working Document 02/04/20 147
It should also display the date 04.02.20, which is not formatted consistently.
If, fortunately, there is always the same number of characters at the end of a cell, then you can also use the LEFT and RIGHT functions.
Then, similar to the PART function—which extracts the middle portion of data from a cell—only the data to the left or right of a specific character is read. A combination of LEFT and RIGHT is always necessary when you want Excel to read the characters from the right—because with the PART function, Excel always reads from the left.
In that case, you could simply use an entry like:
"Office Supplies 12/18/2019 44" and "Expenses 01/02/2020 25"
Use the same formula. You would need to set it up like this:
=LEFT(RIGHT(text, first_character), number_of_characters)
In our example, the formula looks something like this:
"=LEFT(RIGHT(A8,13),10)"
and converts “Office Supplies 12/18/2019 44” to just 12/18/2019—just as it converts “Expenses 01/02/2020 25” to the date “01/02/2020”
Unfortunately, Excel currently doesn't offer a way to extract any number of characters from any position within a cell. Until an Excel programmer comes up with such a function, a little manual work will still be necessary.
About the authors
Wiresoft Editorial Team
The Wiresoft editorial team explains software, licenses, and how to use Windows, Office, and servers in a clear and practical way. The articles are based on questions that customers ask Wiresoft in their day-to-day lives.
Sources and further reading
- Microsoft Support: Help and Learning for ExcelSource date:
Matching productsOffice