+ Reply to Thread
Results 1 to 3 of 3

Delete last character if letter

  1. #1
    Valued Forum Contributor
    Join Date
    06-10-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    341

    Delete last character if letter

    Hi,

    I have a number of different codes which can be anywhere from 6 to 11 characters long and either end with a number or a letter.

    What I want a code to do is to remove the last character if it is a letter only.

    How would I do this?

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Delete last character if letter

    You could try

    =LEFT(A2,LEN(A2)-1)&IF(ISNUMBER(--RIGHT(A2)),RIGHT(A2),"")

  3. #3
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Delete last character if letter

    Hi in VBA try this:
    Please Login or Register  to view this content.
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1