Spreadsheet Practice

How to remove a leading apostrophe from cells in Excel

Formula (Excel and Google Sheets)

=IF(LEFT(A2)="'",MID(A2,2,LEN(A2)),A2)

When the apostrophe is a real character in the text, drop it with =IF(LEFT(A2)="'",MID(A2,2,LEN(A2)),A2).

Result on the example
one result per row in B2, filled down to B6
Works in
Every current version
Google Sheets
Same formula

See it work

The formula is already in B2, filled down to B6. Change any input and the result updates, or edit the formula to experiment.

How it works

Some CSV and database exports put a real apostrophe in front of IDs to protect their leading zeros. LEFT checks the first character, and MID from position 2 returns everything after it. IDs without an apostrophe pass through unchanged, and the result stays text, so "00123" keeps its zeros.

=IF(LEFT(A2)="'",MID(A2,2,LEN(A2)),A2)

Result"00123"

  1. A2"'00123"

    The value in A2.

  2. LEFT(A2)"'"

    LEFT: Characters from the start of text.

    • textA2"'00123"
  3. LEFT(A2)="'"TRUE

    The = operator tests whether the two sides are equal.

  4. LEN(A2)6

    LEN: Number of characters.

    • textA2"'00123"
  5. MID(A2,2,LEN(A2))"00123"

    MID: Characters from the middle of text.

    • textA2"'00123"
    • start_num2
    • num_charsLEN(A2)6
  6. IF(LEFT(A2)="'",MID(A2,2,LEN(A2)),A2)"00123"

    IF: Returns one value if a test is true, another if false.

    • logical_testLEFT(A2)="'"TRUE
    • value_if_trueMID(A2,2,LEN(A2))"00123"
    • value_if_falseA2"'00123"not used

In Google Sheets

The same formula works in Google Sheets: =IF(LEFT(A2)="'",MID(A2,2,LEN(A2)),A2). We ran it in Google Sheets mode on the same data and it returns the same results.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=SUBSTITUTE(A2,"'","",1)00123, 04471, 10442…Removes the first apostrophe. Shorter, but it would also remove one in the middle, as in "O'Neil".

Common mistakes

  • An apostrophe you typed yourself in Excel is a hidden prefix, not part of the value: LEFT(A2) doesn't see it. Those cells are already text; convert them with VALUE, or use Data > Text to Columns > Finish.
  • Converting to numbers drops leading zeros ("00123" becomes 123). Keep IDs as text.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Remove a leading apostrophe from cells

In B2, remove the apostrophe from the start of the ID when there is one, and fill down to B6.

Questions

How do I turn the cleaned IDs into numbers?

Wrap the formula in VALUE: =VALUE(IF(LEFT(A2)="'",MID(A2,2,LEN(A2)),A2)).

Does Google Sheets use the same hidden apostrophe?

Yes. Typing '00123 stores the text 00123, and the formula above handles apostrophes that are part of the text.

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.