+ Reply to Thread
Results 1 to 4 of 4

Remove first character from a cell when its a specific value

  1. #1
    Forum Contributor
    Join Date
    11-20-2008
    Location
    UK
    Posts
    132

    Remove first character from a cell when its a specific value

    I have created a workbook that generates an invoice number and saves as a new workbook in folders based on data entered into the workbook. It's worked fine for a year but suddenly we are finding that one cell (D1), where we enter a title of a book, it's adding a ' at the start even though we didn't type it in and this is causing lots of problems because other macros use this cell to create a new folder to save it in.

    Coping and pasting another empty cell over D1 fixes it temporarily but it keeps coming back. I thought it was because the person that uses it most was pasting in the title from another document where titles are often listed between ' ' but they are adamant that they aren't doing this and are manually typing it in. Whilst I may have my doubts about what they are saying I'm also trying to find a solution so I was wondering if I could automatically delete the ' if it is the first character in a cell.

    I tried entering =IF(LEFT(D1,1)="'",RIGHT(D1,LEN(D1)-1),D1) into a blank cell but find two things.

    1. Whilst the leading ' is removed from the cell, it still shows in Formula Bar
    2. Whatever I type into D1 also appears in the cell where I entered this formula

    Does anyone know why a leading ' is appearing all the time or how I can write a formula or macro that will automatically remove it when it is the first character?

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Remove first character from a cell when its a specific value

    I noticed that if I apply the clean function to the cell with a leading ' it will remove it, BUT you will need to use another cell (helper cell).
    so I put 'cat in cell A7, then =clean(A7) in B7 then copied the result in B7 to D7 as paste special >> values and it returned cat without the '
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Forum Contributor
    Join Date
    11-20-2008
    Location
    UK
    Posts
    132

    Re: Remove first character from a cell when its a specific value

    Ahh okay thank you. I've done as you've suggested and that seems to work. Many thanks for that, much appreciated.

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Remove first character from a cell when its a specific value

    glad I could help, and THANK you for the rep!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Remove everything after a specific character in a cell...
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 06-02-2015, 09:33 AM
  2. Remove Specific Character from Cell
    By maniacalmonkey in forum Excel General
    Replies: 3
    Last Post: 09-11-2014, 07:58 PM
  3. How do I remove all text in a cell after a specific character?
    By Erik Millerd in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 PM
  4. [SOLVED] How do I remove all text in a cell after a specific character?
    By moi in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 07:05 AM
  5. How do I remove all text in a cell after a specific character?
    By moi in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2005, 06:05 AM
  6. How do I remove all text in a cell after a specific character?
    By Erik Millerd in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  7. How do I remove all text in a cell after a specific character?
    By Erik Millerd in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM

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