You can use the LEFT and RIGHT functions in
the Microsoft Excel
spreadsheet program along with the LEN (length) function to remove the leftmost
or rightmost character from a text
string. These functions also work in
Google Sheets,
LibreOffice Calc,
which is the spreadsheet component of the
LibreOffice software
package, and
Apache OpenOffice Calc, which is the spreadsheet program included in
Apache OpenOffice,
though in the Apache OpenOffice Calc program you need to substitute semicolons
(;
) for commas (,
) in the formulas. E.g.,
in Apache OpenOffice Calc you would need to use =RIGHT(A5;LEN(A5) -1)
, instead of =RIGHT(A5,LEN(A5) -1)
as you would in the other
programs.
Removing the leftmost character
The syntax for the RIGHT function is RIGHT(text,[numchars])
.
If you don't include numchars, i.e., you use RIGHT(text)
then the value returned is the rightmost character in the string. E.g.,
if cell A1 has 1ABC
in it, then =RIGHT(A1)
returns
C
. But suppose, instead, you want to remove the leftmost
charaacter from a string. You can use the RIGHT
function to do
so. E.g., suppose I have a column of values, e.g.:
A | B | |
1 | 1ABC | |
2 | 2DEF | |
3 | 3GHI | |
4 | 4JKL | |
5 | 5MNO |
If I want to remove the number at the beginning of each text
string and put the shortened strings in column B, I could, since the
strings are all 4 characters long, use =RIGHT(A1,3)
in column B1
and then copy the formula down through the other cells in column B by clicking
in cell B1 and holding down the leftmost mouse button and dragging downwards
through the other cells in column B and then hitting Ctrl-D.
But suppose the strings vary in length. I.e., suppose I have a worksheet containing the following strings in column A:
A | B | |
1 | 1ABC | |
2 | 2DEFG | |
3 | 3HI | |
4 | 4JKL | |
5 | 5MNOP |
[ More Info ]