How can I remove the last 2 characters from a string using Excel? 2

How to Remove the Last Two Characters from Text in Excel

Excel: Remove Last 2 Characters from String


In the modern landscape of data management, maintaining high levels of data integrity is paramount for professionals across all sectors. Microsoft Excel remains the industry standard for data analysis, offering a robust suite of tools designed to manipulate and clean information with surgical precision. One common challenge faced by users involves string manipulation, specifically the need to truncate or remove specific characters from the end of a text string. This process, often referred to as data cleansing, ensures that information is formatted consistently for reporting, database entry, or further computational processing.

Understanding how to efficiently remove the last 2 characters from a cell is a fundamental skill that enhances your ability to handle unstructured data. Whether you are dealing with legacy database exports that include unnecessary trailing codes, or simply trying to strip file extensions and units of measurement from a list, mastering formulaic text reduction is essential. By leveraging built-in functions, users can automate these repetitive tasks, thereby reducing the likelihood of manual entry errors and significantly increasing workflow efficiency within any spreadsheet environment.

This comprehensive guide will explore the technical nuances of the LEFT and LEN functions. We will examine how these two components interact to provide a dynamic solution for text truncation. Beyond the basic formula, we will discuss the importance of character encoding and how ASCII values and invisible characters, such as spaces, can impact your results. By the end of this article, you will possess a deep understanding of string operations in Excel and be able to apply these techniques to complex real-world datasets.

The Mechanics of the LEFT Function

The LEFT function is a cornerstone of text manipulation in Excel. Its primary purpose is to return a specified number of characters from the beginning of a text string. The syntax is straightforward, requiring the source text and the number of characters you wish to retain. In the context of removing trailing characters, the LEFT function acts as the primary container, determining which part of the original data will be preserved and which part will be discarded based on the mathematical logic provided in its second argument.

When utilizing the LEFT function, it is important to understand that it operates on a character-by-character basis. For standard Latin-based scripts, each letter, number, or symbol is treated as a single unit. However, for users working with double-byte character sets, such as those found in various Asian languages, Excel provides variations like LEFTB to handle byte counts rather than character counts. For most general purposes, the standard LEFT function is sufficient and forms the basis for our character removal formula.

The versatility of the LEFT function extends beyond simple truncation. It is frequently combined with other logical operators to perform complex data extraction. For instance, in a business intelligence context, you might use LEFT to isolate country codes from phone numbers or department IDs from employee records. When we aim to remove the last 2 characters, we do not provide a static number to the LEFT function; instead, we use a nested calculation to determine the length dynamically, ensuring the formula remains accurate regardless of the input string’s total length.

Calculating String Length with the LEN Function

To remove a specific number of characters from the end of a string, we must first know the total number of characters present. This is where the LEN function becomes indispensable. The LEN function performs a simple but vital task: it counts every character within a cell, including letters, numbers, punctuation, and, most importantly, whitespaces. This total count serves as the baseline for our mathematical subtraction, allowing the formula to adapt to strings of varying lengths.

It is a common misconception that Excel ignores spaces when calculating length. On the contrary, the LEN function adheres strictly to the Unicode or ASCII representation of the data. If a cell contains “Data ” (with two trailing spaces), the LEN function will return a value of 6, not 4. This behavior is crucial to keep in mind when your character removal results appear unexpected. Often, what looks like a failed formula is actually the result of the LEN function correctly counting invisible trailing spaces that the user did not intend to keep.

In advanced data analytics, the LEN function is often used for validation purposes. For example, ensuring that a Social Security Number or a Credit Card Number contains the correct number of digits before processing. In our specific use case, LEN provides the necessary variable to calculate the “remaining” length. By subtracting 2 from the total count provided by LEN, we tell Excel exactly how many characters to keep from the left side, effectively “chopping off” the unwanted suffix.

Constructing the Combined Truncation Formula

By nesting the LEN function inside the LEFT function, we create a dynamic algorithm that can process an entire column of data with a single formula. This combination is the standard method for removing a fixed number of characters from the end of a string in Excel. The mathematical logic is simple: Total Length minus N characters. In this specific scenario, N is 2. This approach is far superior to manual editing, as it can be applied to thousands of rows instantly, ensuring consistency across the entire dataset.

You can use the LEFT function combined with the LEN function to do so:

=LEFT(A2,LEN(A2)-2)

This particular formula removes the last 2 characters from the string in cell A2. The execution order is as follows: first, Excel evaluates the LEN(A2) part of the formula to determine the total character count. Second, it subtracts 2 from that total. Finally, the LEFT function uses that resulting number to display the characters starting from the far left of the cell. This nested function approach is a hallmark of efficient Excel usage, allowing for complex logic to be contained within a single cell reference.

Consider the implications of this formula for scalability. If you were to use a static number, such as =LEFT(A2, 5), the formula would only work for strings that are exactly 7 characters long. By using LEN(A2)-2, the formula becomes “length-agnostic.” It will work just as effectively on a string of 10 characters (returning the first 8) as it will on a string of 100 characters (returning the first 98). This flexibility is vital when working with real-world data where string lengths are rarely uniform.

Practical Example: Removing Suffixes from Team Names

The following example shows how to use this formula in practice. Suppose we have a list of basketball team names where each entry has been appended with a two-character code or extraneous data that we wish to remove. This is a common scenario in data migration where legacy systems add internal tags to names. To clean this list and prepare it for a final report, we need a clean string representing only the team names.

Suppose we have the following list of basketball team names:

In the image above, the team names in column A contain characters at the end that are not required for our analysis. To remove the last 2 characters from each team name, we need to apply our combined formula in a new column. This allows us to keep the original data intact in column A while generating the cleaned version in column B, a practice known as non-destructive editing.

We can type the following formula into cell B2 to do so:

=LEFT(A2,LEN(A2)-2)

Once the formula is entered into the first cell, Excel provides several ways to apply it to the rest of the dataset. You can use the fill handle (the small square at the bottom-right corner of the cell) and drag it down the column. Alternatively, double-clicking the fill handle will automatically populate the formula down to the last row of adjacent data. This automation is a key component of productivity when handling large-scale spreadsheets.

Excel remove last 2 characters from string

As shown in the updated image, Column B now displays the team names from column A with the last 2 characters successfully removed. The transformation is clean and uniform. If the original team name was “Lakers99,” the new cell will display “Lakers.” This method is incredibly reliable for standardizing text data across diverse entries.

Detailed Breakdown: How This Formula Works

To fully grasp the power of this Excel formula, it is helpful to visualize the step-by-step process the calculation engine undergoes. Let us recall the formula that we used to remove the last 2 characters from the string in cell A2: =LEFT(A2,LEN(A2)-2). This sequence of operations ensures that the formula is dynamic and responsive to the content of each specific cell it references.

  • Step 1: The LEN(A2) function is invoked. If cell A2 contains the text “Celtics88”, the function returns the integer 9.
  • Step 2: Excel performs the subtraction: 9 minus 2 equals 7.
  • Step 3: The LEFT function is now executed as =LEFT(“Celtics88”, 7).
  • Step 4: Excel counts 7 characters from the left: C-e-l-t-i-c-s, and returns “Celtics”.

The LEN() function in Excel is strictly used to find the length of a string. It is important to note that this includes every single character. In computer science, a character is any unit of information that corresponds to a symbol, such as a letter, a digit, or a punctuation mark. Because Excel treats the entire contents of a cell as a string in this context, the formula is highly predictable and robust.

Thus, our formula tells Excel to extract the amount of characters equal to the length of the string minus 2 characters starting from the left side of the string. This logic is universal and can be adapted to remove any number of characters simply by changing the “2” to another integer. For example, to remove a 3-character file extension, you would simply use LEN(A2)-3.

Addressing Whitespace and Invisible Characters

One of the most frequent issues users encounter when using string formulas is the presence of blank spaces. In Excel, a space is not “nothing”—it is a character with its own ASCII code (32). If your string has trailing spaces that you cannot see, the LEN function will count them, and the LEFT function will “remove” those spaces instead of the visible text you intended to target.

Note: Blank spaces in a string count as characters. You may need to first remove blank spaces to get your desired result. To combat this, you can wrap your cell reference in the TRIM function. The TRIM function automatically removes all leading and trailing spaces from a string, leaving only single spaces between words. A revised, “space-proof” formula would look like this: =LEFT(TRIM(A2), LEN(TRIM(A2))-2). This ensures that the LEN function is only counting the actual characters of the text.

Furthermore, some data imported from the web may contain non-breaking spaces ( ), which the standard TRIM function cannot remove. In such advanced cases, the CLEAN function or a SUBSTITUTE function (replacing CHAR(160) with an empty string) might be required before applying the truncation formula. Understanding these nuances is what separates a basic user from an Excel expert, ensuring that data quality is maintained even with messy source files.

Alternative Approaches: Flash Fill and Power Query

While formulas are the traditional way to remove characters, Excel offers modern alternatives that might be faster for one-time tasks. One such feature is Flash Fill. Introduced in Excel 2013, Flash Fill recognizes patterns as you type. If you have a column of data and you manually type the first two rows with the last 2 characters removed, Excel will often suggest an automatic fill for the remaining rows. You simply press Enter to accept the suggestion, and the data is cleaned without the need for a formula.

For more complex or repetitive data transformations involving large datasets, Power Query is the superior choice. Power Query is a data transformation and data preparation engine that allows you to perform “Split Column” or “Extract” operations through a user interface. To remove the last 2 characters in Power Query, you would select the column, choose “Extract,” and then select “First Characters.” You would then specify a count based on a subtraction rule, similar to the LEN logic, but handled within the Power Query editor.

The advantage of Power Query is that it creates a reproducible workflow. If you update your source data, you can simply click “Refresh,” and the character removal steps will be applied automatically to the new data. This is particularly useful in business environments where data is exported from an ERP or CRM system on a weekly or monthly basis. Choosing between a formula, Flash Fill, or Power Query depends on whether you need a dynamic update, a one-off fix, or a scalable automated process.

Conclusion and Further Learning

Mastering the ability to remove characters from a string is a foundational step in becoming proficient with Excel’s text functions. By combining LEFT and LEN, you gain a powerful, dynamic tool that can handle a variety of data cleaning tasks with ease. This method is reliable, easy to implement, and essential for anyone looking to improve the accuracy and organization of their data analysis projects.

As you continue to develop your skills, you may find that other text-based functions become equally useful. For example, the RIGHT and MID functions allow you to extract characters from different positions within a string, while FIND and SEARCH can help you locate specific characters to use as anchors for your extractions. The following tutorials explain how to perform other common operations in Excel and provide a deeper dive into these advanced string manipulation techniques:

Excel: A Formula for MID From Right
Excel: How to Use MID Function for Variable Length Strings

Cite this article

stats writer (2026). How to Remove the Last Two Characters from Text in Excel. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-remove-the-last-2-characters-from-a-string-using-excel/

stats writer. "How to Remove the Last Two Characters from Text in Excel." PSYCHOLOGICAL SCALES, 18 Feb. 2026, https://scales.arabpsychology.com/stats/how-can-i-remove-the-last-2-characters-from-a-string-using-excel/.

stats writer. "How to Remove the Last Two Characters from Text in Excel." PSYCHOLOGICAL SCALES, 2026. https://scales.arabpsychology.com/stats/how-can-i-remove-the-last-2-characters-from-a-string-using-excel/.

stats writer (2026) 'How to Remove the Last Two Characters from Text in Excel', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-remove-the-last-2-characters-from-a-string-using-excel/.

[1] stats writer, "How to Remove the Last Two Characters from Text in Excel," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, February, 2026.

stats writer. How to Remove the Last Two Characters from Text in Excel. PSYCHOLOGICAL SCALES. 2026;vol(issue):pages.

Download Post (.PDF)
PDF
Scroll to Top