+ Reply to Thread
Results 1 to 14 of 14

Trying to get rid of leading apostrophes in text cells

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-16-2011
    Location
    Portland, OR
    MS-Off Ver
    Excel 2016 Preview
    Posts
    105

    Trying to get rid of leading apostrophes in text cells

    I've been searching all morning for a solution and nothing has worked. I also notice something strange:

    If I manually remove the apostrophe, enter out of the cell, and select it again, the apostrophe is back.

    This is freaky. Any ideas what's going on here?

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,423

    Re: Trying to get rid of leading apostrophes in text cells

    You could use this formula in the adjacent cell:

    =RIGHT(A1,LEN(A1)-1)

    then copy this down. Then you could fix the values and then delete column A.

    Hope this helps.

    Pete

  3. #3
    Forum Contributor dogberry's Avatar
    Join Date
    07-15-2012
    Location
    Wales, UK
    MS-Off Ver
    Excel 2010
    Posts
    624

    Re: Trying to get rid of leading apostrophes in text cells

    Hi

    The apostrophe is normally used to turn a number into text if I remember correctly try removing it and format cell to general or number and see if it re appears.


    Chris
    Click my star if I helped Thanks

  4. #4
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Trying to get rid of leading apostrophes in text cells

    This works on a PC, try it on your Mac:

    Sub TickKiller()
    Dim r As Range
    For Each r In ActiveSheet.Cells.SpecialCells(xlConstants, xlTextValues)
        If r.PrefixCharacter = "'" Then
            r.Value = r.Value
        End If
    Next
    End Sub
    Gary's Student

  5. #5
    Forum Contributor
    Join Date
    12-16-2011
    Location
    Portland, OR
    MS-Off Ver
    Excel 2016 Preview
    Posts
    105

    Re: Trying to get rid of leading apostrophes in text cells

    Nothing is working.
    I'm attaching a sample that has about 20 cells. Some have the apostrophe and others don't.

    The data cam from multiple source. I'm going to start tracing back where these strange ones came from.

    Thanks for all the help.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    12-16-2011
    Location
    Portland, OR
    MS-Off Ver
    Excel 2016 Preview
    Posts
    105

    Re: Trying to get rid of leading apostrophes in text cells

    Here's one thing I did:

    Save the sheet as a CSV
    Reopen it

    All of my formatting is gone but those apostrophes are gone, too.

    This is a solution for now but this is freaky. This started because someone had multiple entries when he synced his phone, Outlook, iPad and other devices. Maybe something added the apostrophe and started seeing Mary and 'Mary as being unique? But why won't that apostrophe just go away?

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,423

    Re: Trying to get rid of leading apostrophes in text cells

    I don't see the problem when I opened your file. I can only see the apostrophe in the Formula Bar when I select a cell.

    I think this has something to do with Lotus compatibility. Click on the File button, then Excel Options (at the bottom of the panel) and then on Advanced. Scroll down to the bottom and you will see 3 options for Lotus compatibility - on my machine none of them are ticked, so if you have any of them ticked then un-tick them and click OK. Does that make any difference?

    Hope this helps.

    Pete

  8. #8
    Forum Contributor dogberry's Avatar
    Join Date
    07-15-2012
    Location
    Wales, UK
    MS-Off Ver
    Excel 2010
    Posts
    624

    Re: Trying to get rid of leading apostrophes in text cells

    Hi

    Looking at your sample it is only the first instance of the entry that has the apostrophe as you say when you delete it it returns but if you delete the cell completely and copy paste the second instance it goes for good, this may be from a txt or csv file that you are importing rather than excel itself.

    Chris

  9. #9
    Forum Contributor
    Join Date
    12-16-2011
    Location
    Portland, OR
    MS-Off Ver
    Excel 2016 Preview
    Posts
    105

    Re: Trying to get rid of leading apostrophes in text cells

    You're right. Not all of the files were Excel. There were originally 5 files that were brought together. Some were text others were CSV.

    However, the problem was that there were 1500 rows stretching out to column AE. Finding everything with a hidden apostrophe and manually correcting would have been a nightmare.

  10. #10
    Registered User
    Join Date
    11-26-2012
    Location
    Kitchener, Ontario, Canada
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: Trying to get rid of leading apostrophes in text cells

    The trick is to use the ".ClearFormat" for entire sheet as follows
    Public Sub Remove_Apostrophe()
        Sheet1.Cells.ClearFormats
    End Sub
    or for a range as follows
    Public Sub Remove_Apostrophe()
        Dim sRange As Range
        ' you need to define the range first  i.e set sRange = .....
        sRange.Cells.ClearFormats
    End Sub
    Last edited by aelgadi; 12-05-2012 at 04:51 PM. Reason: missing words and rephrased
    aelgadi

    > Click Star if I helped. Thanks

  11. #11
    Forum Contributor
    Join Date
    12-16-2011
    Location
    Portland, OR
    MS-Off Ver
    Excel 2016 Preview
    Posts
    105

    Re: Trying to get rid of leading apostrophes in text cells

    That did it! RESOLVED!

  12. #12
    Forum Contributor
    Join Date
    12-16-2011
    Location
    Portland, OR
    MS-Off Ver
    Excel 2016 Preview
    Posts
    105

    Re: Trying to get rid of leading apostrophes in text cells

    Quote Originally Posted by aelgadi View Post
    The trick is to use the ".ClearFormat" for entire sheet as follows
    Public Sub Remove_Apostrophe()
        Sheet1.Cells.ClearFormats
    End Sub
    or for a range as follows
    Public Sub Remove_Apostrophe()
        Dim sRange As Range
        ' you need to define the range first  i.e set sRange = .....
        sRange.Cells.ClearFormats
    End Sub
    That did it! RESOLVED!!
    Thank you!

  13. #13
    Registered User
    Join Date
    01-17-2013
    Location
    Nashville, Tennessee
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Trying to get rid of leading apostrophes in text cells

    I have been fighting with this problem for an hour. Finally read that the leading apostrophe instructs Excel to "align left". I had tried using the CLEAN function, but it had not worked. This time I used the CLEAN function and then, while the formula was still in the cells, I highlighted and used the "Align Left" command. Next I copied and pasted as values and VOILIA!! the dratted leading apostrophe was gone! WOOT WOOT!!! My vlookup now works perfectly.
    d.c.1

  14. #14
    Registered User
    Join Date
    01-01-2014
    Location
    Astoria, OR
    MS-Off Ver
    Excel for Mac 2011
    Posts
    3

    Re: Trying to get rid of leading apostrophes in text cells

    I too had a mix of cells, some with and some without leading apostrophes. The apostrophes only showed in the formula bar.

    This worked for me in Excel 2016 for Mac:
    Copy/Paste Special, checking "Values and number formats". (Checking just "Values" did not do it.)
    Last edited by miz_mdk; 12-29-2017 at 08:14 PM. Reason: clarity

+ 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