REPLACE

The REPLACE function replaces part of a text string with another text value based on the specified position and length. The index starts at 1, where the first character in the text string has an index of 1.

Syntax

REPLACE(old_string, index, length, replace_text)

Arguments

  • old_string: The original text string.
  • index: The starting position of the characters to replace.
  • length: The number of characters to replace.
  • replace_text: The text string that replaces the specified characters.

Return value

Returns the updated text string after replacement.

Example

REPLACE("Sales_US", 7, 2, "UK")

Returns Sales_UK.

Excel equivalent

REPLACE

Fabric Plan
Enterprise planning, integrated with PowerTable and Intelligence, native to Microsoft Fabric. Co-engineered with Lumel.
CERTIFIED BY
Fabric Planning is certified by IBCS
Microsoft, Azure, Copilot, Excel, Fabric IQ, Microsoft Entra, Microsoft Fabric, Microsoft Teams, OneLake, Outlook, Power Automate, Power BI and SharePoint are trademarks of the Microsoft group of companies. IBCS is a registered trademark of IBCS Association. All other trademarks are the property of their respective owners.

This community is operated independently by Lumel. Nothing on this site constitutes a representation or warranty by Microsoft.