Skip to content

Wiresoft · Wiresoft Portal Ltd.

Reading display

Your display preferences are saved on this device. Resetting removes the saved selection.

Office

Microsoft Excel PART function – extracting data from a cell

Excel has a whole host of brilliant features. In this post, we’ll show you how to split data in a cell and cut it out!

By Wiresoft Editorial Team

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.

Read-aloud settings

Checking available voices.

Overview

Have you ever had a huge 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?

The Excel function PART is used to neatly separate data contained within a single cell. It can neatly split data contained within a cell and distribute it across several cells.

Whenever you want to sort, filter or count data by different categories, this function is really handy.

This is how the TEIL function is structured

One use case for TEIL is, for example, when you have inserted a large number of files – say, from an accounts spreadsheet – into Excel and want to split them into individual parts.

You can insert the file names in Excel using the CELL function; we also have a tutorial on this.

If, for example, 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. This is where you select the cells from which you wish to extract parts into another cell.

First_character: This value must be a number and must be at least 1. The number defines the character in the cell from which the text is to 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 digits 889933.

Once you have entered the function correctly, you can then select the cell and left-click on the small green square in the bottom right-hand corner of the cell’s border to enlarge it so that all product numbers are converted.

How can the TEIL function be used effectively?

The SUBTOTAL function is very useful in itself, but its use is limited. This is because as soon as you have entries of different lengths in a cell, the function reaches its limits.

You can now combine the SUBSTRUCTURE function with the LENGTH 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 accounts. Not only did the accounting programme 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 can now be reformatted correctly, it must be extracted using the PART and LENGTH functions.

The example here is the entry

“Working document 22 December 2019 559”

To combine the SUB and LEN functions, start by following the same steps as for the SUB function. To ensure that Excel knows which parts of the data 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 4 February 2020 147

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 the LEFT and RIGHT functions can also be used.

Then, in a similar way to the PART function – which extracts the middle section 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 required 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 such as:

“Office supplies 18 December 2019 44” and “Expenses 2 January 2020 25”

Use the same formula. You would need to set it up as follows:

=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 18 Dec 2019 44” to simply 18 Dec 2019 – just as it converts “Expenses 2 Jan 2020 25” to the date “2 Jan 2020”

Unfortunately, there is currently no way in Excel to extract any number of characters from any position within a cell. Until an Excel programmer comes up with such a function, a bit of manual work will still be required.

About the authors

Wiresoft Editorial Team

The Wiresoft editorial team explains software, licences and how to use Windows, Office and servers in a clear and practical way. The articles are based on the questions that customers ask Wiresoft in their day-to-day lives.

Sources and further reading

Matching productsOffice

More on this topic

KEEP THE CONVERSATION GOING

Comments on this article

Reviewed comments and replies from the editorial team.

Comment on this article

There are no currently approved comments on this page yet.

YOUR SELECTION

Your basket