MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
July
Sun Mon Tue Wed Thu Fri Sat
           
29
         
2017
Months
Jul


Sat, Jul 29, 2017 10:05 pm

Chopping off the leftmost or rightmost character of a string in Excel

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.:

  AB
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:

  AB
1 1ABC 
2 2DEFG 
3 3HI 
4 4JKL 
5 5MNOP 

[ More Info ]

[/software/office/excel] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo