Spreadsheet Practice

How to insert a character at a specific position in text in Excel

Formula (Excel and Google Sheets)

=REPLACE(A2,$E$1,0,$G$1)

Use REPLACE with a length of 0, which inserts instead of replacing: =REPLACE(A2,4,0,"-") puts a dash before the 4th character.

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

REPLACE removes a number of characters at a position and puts new text there. With 0 characters to remove, nothing is lost and the new text is simply inserted before the character at that position.

=REPLACE(A2,$E$1,0,$G$1)

Result"ABC-1042"

  1. A2"ABC1042"

    The value in A2.

  2. $E$14

    The value in E1.

  3. $G$1"-"

    The value in G1.

  4. REPLACE(A2,$E$1,0,$G$1)"ABC-1042"

    REPLACE: Replaces characters by position.

    • old_textA2"ABC1042"
    • start_num$E$14
    • num_chars0
    • new_text$G$1"-"

In Google Sheets

The same formula works in Google Sheets: =REPLACE(A2,$E$1,0,$G$1). 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
=LEFT(A2,$E$1-1)&$G$1&MID(A2,$E$1,LEN(A2))ABC-1042, NWX-2087, SEA-0031…Split the text in two and join it back with the new character between the halves.

Common mistakes

  • Positions start at 1. To insert after the 3rd character, use position 4.
  • Codes stored as numbers lose their leading zeros before you start. Store them as text, or pad first with TEXT(A2,"0000000").

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.

Insert a character at a specific position in text

In B2, insert the character in G1 at the position in E1 (before the 4th character), and fill down to B6.

Questions

How do I insert characters at several positions?

Nest REPLACE, working from the end so the positions don't shift: =REPLACE(REPLACE(A2,7,0,"-"),4,0,"-").

How do I add a space between letters and numbers?

If the letters are always 3 characters, insert at 4: =REPLACE(A2,4,0," ").

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.