---
title: "REPLACE function in Excel: syntax and examples | PracticeExcel"
description: "How to use REPLACE in Excel and Google Sheets: change, insert or delete characters at a given position in a text."
canonical_url: "https://practiceexcelonline.com/functions/replace"
locale: en
meta:
  "og:description": "How to use REPLACE in Excel and Google Sheets: change, insert or delete characters at a given position in a text."
  "og:image": "https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~UkVQTEFDRSBmdW5jdGlvbiBpbiBFeGNlbDogc3ludGF4IGFuZCBleGFtcGxlcw%2Cdescription_~SG93IHRvIHVzZSBSRVBMQUNFIGluIEV4Y2VsIGFuZCBHb29nbGUgU2hlZXRzOiBjaGFuZ2UsIGluc2VydCBvciBkZWxldGUgY2hhcmFjdGVycyBhdCBhIGdpdmVuIHBvc2l0aW9uIGluIGEgdGV4dC4%2Ceyebrow_Excel%2Bfunctions%2Csite_practiceexcel%2Ccode_~UkVQTEFDRShvbGRfdGV4dCwgc3RhcnRfbnVtLCBudW1fY2hhcnMsIG5ld190ZXh0KQ%2Cp_Ii9mdW5jdGlvbnMvcmVwbGFjZSI%2Cs_4lS8viLR11veIU6A.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "REPLACE function in Excel: syntax and examples | PracticeExcel"
  "twitter:image": "https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~UkVQTEFDRSBmdW5jdGlvbiBpbiBFeGNlbDogc3ludGF4IGFuZCBleGFtcGxlcw%2Cdescription_~SG93IHRvIHVzZSBSRVBMQUNFIGluIEV4Y2VsIGFuZCBHb29nbGUgU2hlZXRzOiBjaGFuZ2UsIGluc2VydCBvciBkZWxldGUgY2hhcmFjdGVycyBhdCBhIGdpdmVuIHBvc2l0aW9uIGluIGEgdGV4dC4%2Ceyebrow_Excel%2Bfunctions%2Csite_practiceexcel%2Ccode_~UkVQTEFDRShvbGRfdGV4dCwgc3RhcnRfbnVtLCBudW1fY2hhcnMsIG5ld190ZXh0KQ%2Cp_Ii9mdW5jdGlvbnMvcmVwbGFjZSI%2Cs_4lS8viLR11veIU6A.png"
---

> Index of every page on this site: [llms.txt](https://practiceexcelonline.com/llms.txt)

# **The REPLACE function**

Replaces part of a text by position. From a start character, a number of characters is swapped for new text. To replace by content instead, use SUBSTITUTE.

=

REPLACE(

## **Syntax**

```
REPLACE(old_text, start_num, num_chars, new_text)
```

<dl><dt>**old_text **</dt>
<dd>The text to change.</dd>
<dt>**start_num **</dt>
<dd>The position of the first character to replace, counting from 1.</dd>
<dt>**num_chars **</dt>
<dd>How many characters to replace. 0 inserts new_text without removing anything.</dd>
<dt>**new_text **</dt>
<dd>The text to put in their place. Empty text ("") deletes them.</dd></dl>

## **Examples**

B1`=REPLACE(<sup>1</sup>"2023-Q4",<sup>2</sup>1,<sup>3</sup>4,<sup>4</sup>"2024")`

|  | A | B |
| --- | --- | --- |
| 1 |  | **2024-Q4** |

**In plain words:** In <sup>1</sup>2023-Q4, replace <sup>3</sup>4 characters <sup>2</sup>from the first one with <sup>4</sup>2024.

C1=REPLACE(A2,1,3,"")

|  | A | B | C |
| --- | --- | --- | --- |
| 1 | Code |  | **1042** |
| 2 | ID-1042 |  | |

B1=REPLACE("5551234567",4,0,"-")

|  | A | B |
| --- | --- | --- |
| 1 |  | **555-1234567** |

## **Questions**

<details>

<summary>

### What is the difference between REPLACE and SUBSTITUTE?

</summary>

REPLACE works by position, such as "four characters from the start". SUBSTITUTE works by content, such as "every dash". When you know what to replace but not where it is, use SUBSTITUTE.

</details>

<details>

<summary>

### Can REPLACE insert text without removing any?

</summary>

Yes. Set num\_chars to 0, as in =REPLACE("5551234567",4,0,"-"), which puts a dash after the third digit.

</details>

## **Related functions**

- [**SUBSTITUTE**](https://practiceexcelonline.com/functions/substitute)
- [**MID**](https://practiceexcelonline.com/functions/mid)
- [**LEFT**](https://practiceexcelonline.com/functions/left)
- [**LEN**](https://practiceexcelonline.com/functions/len)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://practiceexcelonline.com/#identity","@type":"Organization","name":"PracticeExcel","url":"https://practiceexcelonline.com/","logo":{"@id":"https://practiceexcelonline.com/#logo"}},{"@id":"https://practiceexcelonline.com/#website","@type":"WebSite","inLanguage":"en-US","name":"PracticeExcel","url":"https://practiceexcelonline.com/","alternateName":["Practice Excel Online","PracticeExcelOnline.com"],"publisher":{"@id":"https://practiceexcelonline.com/#identity"},"workTranslation":{"@id":"https://excelopgaver.dk/#website"}},{"@id":"https://practiceexcelonline.com/functions/replace#webpage","description":"How to use REPLACE in Excel and Google Sheets: change, insert or delete characters at a given position in a text.","name":"REPLACE function in Excel: syntax and examples","url":"https://practiceexcelonline.com/functions/replace","@type":["WebPage","FAQPage"],"breadcrumb":{"@id":"https://practiceexcelonline.com/functions/replace#breadcrumb"},"isPartOf":{"@id":"https://practiceexcelonline.com/#website"},"mainEntity":[{"@id":"https://practiceexcelonline.com/functions/replace#/schema/question/1"},{"@id":"https://practiceexcelonline.com/functions/replace#/schema/question/2"}],"potentialAction":[{"@type":"ReadAction","target":["https://practiceexcelonline.com/functions/replace"]}],"primaryImageOfPage":{"@id":"https://practiceexcelonline.com/#logo"}},{"@id":"https://practiceexcelonline.com/functions/replace#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://practiceexcelonline.com","position":1},{"@type":"ListItem","name":"Excel functions","item":"https://practiceexcelonline.com/functions","position":2},{"@type":"ListItem","name":"REPLACE function in Excel: syntax and examples","position":3}]},{"@id":"https://practiceexcelonline.com/functions/replace#article","description":"How to use REPLACE in Excel and Google Sheets: change, insert or delete characters at a given position in a text.","headline":"REPLACE function in Excel: syntax and examples","inLanguage":"en-US","thumbnailUrl":"https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~UkVQTEFDRSBmdW5jdGlvbiBpbiBFeGNlbDogc3ludGF4IGFuZCBleGFtcGxlcw%2Cdescription_~SG93IHRvIHVzZSBSRVBMQUNFIGluIEV4Y2VsIGFuZCBHb29nbGUgU2hlZXRzOiBjaGFuZ2UsIGluc2VydCBvciBkZWxldGUgY2hhcmFjdGVycyBhdCBhIGdpdmVuIHBvc2l0aW9uIGluIGEgdGV4dC4%2Ceyebrow_Excel%2Bfunctions%2Csite_practiceexcel%2Ccode_~UkVQTEFDRShvbGRfdGV4dCwgc3RhcnRfbnVtLCBudW1fY2hhcnMsIG5ld190ZXh0KQ%2Cp_Ii9mdW5jdGlvbnMvcmVwbGFjZSI%2Cs_4lS8viLR11veIU6A.png","@type":["Article","TechArticle"],"author":{"@id":"https://practiceexcelonline.com/#identity"},"image":{"@id":"https://practiceexcelonline.com/#/schema/image/1"},"isPartOf":{"@id":"https://practiceexcelonline.com/functions/replace#webpage"},"mainEntityOfPage":{"@id":"https://practiceexcelonline.com/functions/replace#webpage"},"publisher":{"@id":"https://practiceexcelonline.com/#identity"}},{"@id":"https://practiceexcelonline.com/functions/replace#/schema/question/1","@type":"Question","inLanguage":"en-US","name":"What is the difference between REPLACE and SUBSTITUTE?","acceptedAnswer":{"@type":"Answer","text":"REPLACE works by position, such as \"four characters from the start\". SUBSTITUTE works by content, such as \"every dash\". When you know what to replace but not where it is, use SUBSTITUTE."}},{"@id":"https://practiceexcelonline.com/functions/replace#/schema/question/2","@type":"Question","inLanguage":"en-US","name":"Can REPLACE insert text without removing any?","acceptedAnswer":{"@type":"Answer","text":"Yes. Set num_chars to 0, as in =REPLACE(\"5551234567\",4,0,\"-\"), which puts a dash after the third digit."}},{"@id":"https://practiceexcelonline.com/#logo","@type":"ImageObject","caption":"PracticeExcel","contentUrl":"https://practiceexcelonline.com/brand/practiceexcel/icon-512.png","inLanguage":"en-US","url":"https://practiceexcelonline.com/brand/practiceexcel/icon-512.png"},{"@id":"https://practiceexcelonline.com/#/schema/image/1","@type":"ImageObject","contentUrl":"https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~UkVQTEFDRSBmdW5jdGlvbiBpbiBFeGNlbDogc3ludGF4IGFuZCBleGFtcGxlcw%2Cdescription_~SG93IHRvIHVzZSBSRVBMQUNFIGluIEV4Y2VsIGFuZCBHb29nbGUgU2hlZXRzOiBjaGFuZ2UsIGluc2VydCBvciBkZWxldGUgY2hhcmFjdGVycyBhdCBhIGdpdmVuIHBvc2l0aW9uIGluIGEgdGV4dC4%2Ceyebrow_Excel%2Bfunctions%2Csite_practiceexcel%2Ccode_~UkVQTEFDRShvbGRfdGV4dCwgc3RhcnRfbnVtLCBudW1fY2hhcnMsIG5ld190ZXh0KQ%2Cp_Ii9mdW5jdGlvbnMvcmVwbGFjZSI%2Cs_4lS8viLR11veIU6A.png","inLanguage":"en-US","url":"https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~UkVQTEFDRSBmdW5jdGlvbiBpbiBFeGNlbDogc3ludGF4IGFuZCBleGFtcGxlcw%2Cdescription_~SG93IHRvIHVzZSBSRVBMQUNFIGluIEV4Y2VsIGFuZCBHb29nbGUgU2hlZXRzOiBjaGFuZ2UsIGluc2VydCBvciBkZWxldGUgY2hhcmFjdGVycyBhdCBhIGdpdmVuIHBvc2l0aW9uIGluIGEgdGV4dC4%2Ceyebrow_Excel%2Bfunctions%2Csite_practiceexcel%2Ccode_~UkVQTEFDRShvbGRfdGV4dCwgc3RhcnRfbnVtLCBudW1fY2hhcnMsIG5ld190ZXh0KQ%2Cp_Ii9mdW5jdGlvbnMvcmVwbGFjZSI%2Cs_4lS8viLR11veIU6A.png"}]}
```

## Sitemap

See the full [sitemap](https://practiceexcelonline.com/sitemap.md) for all pages.
