---
title: "SUBSTITUTE, TEXTBEFORE and TEXTAFTER practice exercises | PracticeExcel"
description: "Practice SUBSTITUTE, TEXTBEFORE and TEXTAFTER in a live spreadsheet."
canonical_url: "https://practiceexcelonline.com/practice/substitute-textbefore-textafter"
locale: en
meta:
  "og:description": "Practice SUBSTITUTE, TEXTBEFORE and TEXTAFTER in a live spreadsheet."
  "og:image": "https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~U1VCU1RJVFVURSwgVEVYVEJFRk9SRSBhbmQgVEVYVEFGVEVSIHByYWN0aWNlIGV4ZXJjaXNlcw%2Cdescription_~UHJhY3RpY2UgU1VCU1RJVFVURSwgVEVYVEJFRk9SRSBhbmQgVEVYVEFGVEVSIGluIGEgbGl2ZSBzcHJlYWRzaGVldC4%2Ceyebrow_Excel%2Bpractice%2Bexercises%2Csite_practiceexcel%2Cprops_eyJncmlkIjp7ImNvbHMiOlsiQSIsIkIiXSwicm93cyI6W3sibiI6MSwiY2VsbHMiOlsiUGhvbmUgYXMgdHlwZWQiLCJQaG9uZSJdfSx7Im4iOjIsImNlbGxzIjpbIjAyMC03OTQ2LTAwMTgiLCIiXX1dLCJ0YXJnZXQiOlsxLDFdfX0%2Cp_Ii9wcmFjdGljZS9zdWJzdGl0dXRlLXRleHRiZWZvcmUtdGV4dGFmdGVyIg%2Cs_Ik_u0CU-1OMzz_nk.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "SUBSTITUTE, TEXTBEFORE and TEXTAFTER practice exercises | PracticeExcel"
  "twitter:image": "https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~U1VCU1RJVFVURSwgVEVYVEJFRk9SRSBhbmQgVEVYVEFGVEVSIHByYWN0aWNlIGV4ZXJjaXNlcw%2Cdescription_~UHJhY3RpY2UgU1VCU1RJVFVURSwgVEVYVEJFRk9SRSBhbmQgVEVYVEFGVEVSIGluIGEgbGl2ZSBzcHJlYWRzaGVldC4%2Ceyebrow_Excel%2Bpractice%2Bexercises%2Csite_practiceexcel%2Cprops_eyJncmlkIjp7ImNvbHMiOlsiQSIsIkIiXSwicm93cyI6W3sibiI6MSwiY2VsbHMiOlsiUGhvbmUgYXMgdHlwZWQiLCJQaG9uZSJdfSx7Im4iOjIsImNlbGxzIjpbIjAyMC03OTQ2LTAwMTgiLCIiXX1dLCJ0YXJnZXQiOlsxLDFdfX0%2Cp_Ii9wcmFjdGljZS9zdWJzdGl0dXRlLXRleHRiZWZvcmUtdGV4dGFmdGVyIg%2Cs_Ik_u0CU-1OMzz_nk.png"
---

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

# **SUBSTITUTE, TEXTBEFORE and TEXTAFTER practice exercises**

Replace characters inside a text, and split a text at a separator without counting positions yourself.

[**Start the first exercise**](https://practiceexcelonline.com/practice/substitute-textbefore-textafter/substitute-remove-characters)

TEXTAFTER(TEXTBEFORE(

1. [**1****Remove the dashes with SUBSTITUTE**In B2, use SUBSTITUTE to remove every dash from the phone number in A2. Replace "-" with an empty text, "".](https://practiceexcelonline.com/practice/substitute-textbefore-textafter/substitute-remove-characters)
2. [**2****Take the first name with TEXTBEFORE****Premium**In B2, use TEXTBEFORE to get the text in A2 before the first space.](https://practiceexcelonline.com/practice/substitute-textbefore-textafter/textbefore-first-name)
3. [**3****Flip "Last, First" with TEXTAFTER****Premium**In B2, turn the name in A2 into "Anna Berg". Join TEXTAFTER and TEXTBEFORE around ", " with a space between them.](https://practiceexcelonline.com/practice/substitute-textbefore-textafter/textafter-flip-names)
4. [**4****Take the text between parentheses****Premium**In B2, take the department between the parentheses in A2. Use TEXTAFTER to take what comes after "(", and TEXTBEFORE around it to stop at ")".](https://practiceexcelonline.com/practice/substitute-textbefore-textafter/text-between-parentheses)

## **Functions in this topic**

- [**TEXTAFTER**](https://practiceexcelonline.com/functions/textafter)
- [**TEXTBEFORE**](https://practiceexcelonline.com/functions/textbefore)

## **Read the guide**

- [**How to clean data in Excel with formulas**](https://practiceexcelonline.com/learn/clean-data-in-excel)

```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/practice/substitute-textbefore-textafter#webpage","description":"Practice SUBSTITUTE, TEXTBEFORE and TEXTAFTER in a live spreadsheet.","name":"SUBSTITUTE, TEXTBEFORE and TEXTAFTER practice exercises","url":"https://practiceexcelonline.com/practice/substitute-textbefore-textafter","@type":["WebPage","CollectionPage"],"breadcrumb":{"@id":"https://practiceexcelonline.com/practice/substitute-textbefore-textafter#breadcrumb"},"isPartOf":{"@id":"https://practiceexcelonline.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://practiceexcelonline.com/practice/substitute-textbefore-textafter"]}],"primaryImageOfPage":{"@id":"https://practiceexcelonline.com/#logo"}},{"@id":"https://practiceexcelonline.com/practice/substitute-textbefore-textafter#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://practiceexcelonline.com","position":1},{"@type":"ListItem","name":"Excel practice exercises","item":"https://practiceexcelonline.com/practice","position":2},{"@type":"ListItem","name":"SUBSTITUTE, TEXTBEFORE and TEXTAFTER practice exercises","position":3}]},{"@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"}]}
```

## Sitemap

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