Remove last character from string

To remove the last character from a selected string you need to apply a combination of Excel LEFT and LEN functions

Example: Remove last character from string

Remove last character from string

METHOD 1. Remove last character from string

EXCEL

=LEFT(B5,LEN(B5)-C5)
The formula uses the Excel LEFT and LEN functions to remove the last character from the selected string. This formula links to cell C5 which captures the number of characters to remove, however, given this formula is only removing the last character from a string, this number will always be 1, therefore, you can enter this number (1) directly into the formula.

METHOD 1. Remove last character from string using VBA

VBA

Sub Remove_last_character_from_string()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'apply the formula to remove the last character from a string
ws.Range("D5") = Left(ws.Range("B5"), Len(ws.Range("B5")) - ws.Range("C5"))

End Sub

OBJECTS
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Range: The Range object is a representation of a single cell or a range of cells in a worksheet.
PREREQUISITES
Worksheet Name: Have a worksheet named Analyst.
String: If using the same VBA code ensure that the string from which you want to remove the last character is captured in cell ("B5").
Number of Characters to Remove: Given this tutorial shows how to remove the last character from a string, the number of characters to remove will always be 1. Therefore, you can enter this value (1) directly into the VBA code, given it's a constant no matter which string the formula is applied against.
ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell reference ("D5") in the VBA code to any cell in a worksheet, that doesn't conflict with the formula.
String: Select the string from which you want to remove the last character by changing the cell reference ("B5") to any cell in the worksheet that contains the string and doesn't conflict with the formula.

Explanation about the formula used to remove the last character from a string

EXPLANATION

EXPLANATION
This tutorial explains and provides step by step instructions on how to remove the last character from a string using an Excel and VBA method. Both of the methods apply the LEFT and LEN functions to achieve this.
FORMULA
=LEFT(string,LEN(string)-1)

ARGUMENTS
string: The string from which you want to remove the last character.

RELATED TOPICS

Related Topic Description Related Topic and Description
How to remove the first character from a selected string using an Excel and VBA method
How to remove characters from the left of the selected string using an Excel and VBA method
How to remove characters from the left of the selected string using an Excel and VBA method
How to remove specific characters from a string using an Excel and VBA method