In Excel: =REPLACE(old_text,start_num,num_chars,new_text) replaces characters by POSITION — a fixed span you specify — while =SUBSTITUTE(text,old_text,new_text,[instance_num]) replaces by CONTENT, swapping every match of a specific piece of text wherever it occurs; picking the wrong one for the job is the single most common mistake with either.
On this page7
Decide whether the replacement is defined by a fixed POSITION (always characters 1-4, always the last 2 digits) or by matching CONTENT (replace every "Blue" with "Red", wherever it appears).
For a position-based replacement, use =REPLACE(old_text,start_num,num_chars,new_text), e.g. =REPLACE(A2,1,4,"2027").
For a content-based replacement, use =SUBSTITUTE(text,old_text,new_text), e.g. =SUBSTITUTE(A2,"Blue","Red").
To replace only one specific occurrence when the text appears more than once in a cell, add the optional 4th argument to SUBSTITUTE, e.g. =SUBSTITUTE(A2,"-","/",2) replaces only the 2nd hyphen.
Once the result should stop being a live formula, copy the column and Paste Special ▸ Values.
What this does
REPLACE and SUBSTITUTE sound interchangeable but answer different questions. REPLACE asks "what's at this position?" — it swaps a fixed span of characters (a start position and a length) no matter what those characters actually say, so it keeps working even if the surrounding text changes, as long as the replacement always sits in the same spot. SUBSTITUTE asks "where does this text appear?" — it finds a specific piece of content, anywhere in the string, and swaps every match (or just one, with the optional instance number), regardless of position. Using the position-based one where the content-based one was needed — or the reverse — produces output that looks plausible at a glance but is wrong for any row where the assumption does not hold. The same idea underpins a lot of everyday Excel work, so the few minutes spent getting it right here pay back across every sheet you build afterwards. Treat it as a pattern, not a one-off, and it stops being something you look up and starts being something you reach for. Treat “excel replace formula” as a small repeatable workflow rather than a one-off click you hope to remember next time. Use a small test block before the live file, so any surprise in the affected formula shows up while it is still harmless. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. That turns a text operation that turns messy entries into clean, usable data into a method you can reuse, explain, and defend when the workbook leaves your screen.
A worked example
Cell A2 = "2026-08-12". To change just the year, regardless of what it currently reads, =REPLACE(A2,1,4,"2027") replaces the first 4 characters — whatever they are — with "2027", giving "2027-08-12"; this keeps working even as A2 changes to different years over time, because REPLACE never looks at what those characters say. By contrast, if A2 = "Item-Blue-04" and every occurrence of the word "Blue" across a batch of codes needs to become "Red", =SUBSTITUTE(A2,"Blue","Red") finds the text "Blue" specifically and swaps it, returning "Item-Red-04" — it would do nothing to a cell that did not contain the word "Blue" at all, no matter its position. Reaching for the wrong one of these two similarly-named formulas produces output that looks fine at a glance but is wrong for any row where the position (or the content) doesn't match what was assumed — knowing which question you're actually asking, where vs. what, is the whole trick. If there is any chance you will reuse this, drop it into a small template tab right now: a labelled input area on the left and the formula beside it, checked once against the tool above. Next time the same question comes up, the answer is a single paste away instead of a rebuild from memory.
In Google Sheets
Everything above works in Google Sheets too. Excel and Sheets share the formula syntax used here; only the surrounding menus are arranged differently. That portability is deliberate — learn it once and it follows you between the two tools and across Windows and Mac. Keep this page bookmarked for the next time the same question comes up. Better still, repeat the steps once in your own workbook — doing it yourself is what turns a copied answer into something you remember. Treat “excel replace formula” as a small building block rather than a chore. Once the inputs sit in their own cells and the formula reads from them, the same setup answers a dozen related questions with a tweak, and Excel keeps every dependent figure current as the data changes. The tool above is there so you can rehearse and verify before committing anything to a real workbook; the steps and worked example are there so the logic sticks. Get it right once and it stops costing you time — it starts saving it, every time the question comes back around.
Common mistakes
- Using REPLACE when the target text can sit in a different spot from row to row — REPLACE blindly swaps a fixed character span and can cut into the wrong part of the string, returning a plausible-looking but wrong result.
- Using
SUBSTITUTEwhen the goal was really "the first 4 characters," and the same text happens to also appear later in the string —SUBSTITUTEwithout an instance number replaces every match, not just the intended one. - Forgetting
SUBSTITUTEis case-sensitive:=SUBSTITUTE(A2,"blue","Red")will not touch "Blue". - Miscounting start_num or num_chars in REPLACE on a longer string — pairing it with
=LEN(A2)or FIND() to locate the right position first avoids guessing.
Frequently asked questions
What is the Excel formula to replace text?
Use =SUBSTITUTE(text,old_text,new_text) to replace by matching content, or =REPLACE(old_text,start_num,num_chars,new_text) to replace by fixed position.
What is the difference between REPLACE and SUBSTITUTE?
REPLACE swaps characters based on WHERE they are in the string (a position and a length); SUBSTITUTE swaps characters based on WHAT they are (a specific piece of matching text), wherever it occurs.
Do REPLACE and SUBSTITUTE work in Google Sheets?
Yes — both exist with identical argument order: =REPLACE(text,position,length,new_text) and =SUBSTITUTE(text,search_for,replace_with,[occurrence]) return the same results in Sheets as in Excel.
Other ways people ask this
People reach this page typing “formula for replace in excel” and “excel formulas replace”, among other phrasings; whichever wording you used, the fix above is the one you want.
Why do people search for this in so many different ways?
Because the same task has many names. “formula for replace in excel”, “excel formulas replace” all point at the one operation explained on this page, which is why they all lead here.