---
title: "TRIM function in Excel: syntax and examples | PracticeExcel"
description: "How to use TRIM in Excel and Google Sheets: remove extra spaces that break lookups and comparisons."
canonical_url: "https://practiceexcelonline.com/functions/trim"
locale: en
meta:
  "og:description": "How to use TRIM in Excel and Google Sheets: remove extra spaces that break lookups and comparisons."
  "og:image": "https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~VFJJTSBmdW5jdGlvbiBpbiBFeGNlbDogc3ludGF4IGFuZCBleGFtcGxlcw%2Cdescription_~SG93IHRvIHVzZSBUUklNIGluIEV4Y2VsIGFuZCBHb29nbGUgU2hlZXRzOiByZW1vdmUgZXh0cmEgc3BhY2VzIHRoYXQgYnJlYWsgbG9va3VwcyBhbmQgY29tcGFyaXNvbnMu%2Ceyebrow_Excel%2Bfunctions%2Csite_practiceexcel%2Ccode_TRIM(text)%2Cp_Ii9mdW5jdGlvbnMvdHJpbSI%2Cs_Eerz7PUetJKDLqrq.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "TRIM function in Excel: syntax and examples | PracticeExcel"
  "twitter:image": "https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~VFJJTSBmdW5jdGlvbiBpbiBFeGNlbDogc3ludGF4IGFuZCBleGFtcGxlcw%2Cdescription_~SG93IHRvIHVzZSBUUklNIGluIEV4Y2VsIGFuZCBHb29nbGUgU2hlZXRzOiByZW1vdmUgZXh0cmEgc3BhY2VzIHRoYXQgYnJlYWsgbG9va3VwcyBhbmQgY29tcGFyaXNvbnMu%2Ceyebrow_Excel%2Bfunctions%2Csite_practiceexcel%2Ccode_TRIM(text)%2Cp_Ii9mdW5jdGlvbnMvdHJpbSI%2Cs_Eerz7PUetJKDLqrq.png"
---

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

# **The TRIM function**

Removes spaces from the start and end of a text and turns runs of spaces inside it into one.

=

TRIM(

## **Syntax**

```
TRIM(text)
```

<dl><dt>**text **</dt>
<dd>The text to clean up.</dd></dl>

## **Examples**

C1=TRIM(A2)

|  | A | B | C |
| --- | --- | --- | --- |
| 1 | Name |  | **Anna Berg** |
| 2 | Anna Berg |  | |

C1=LEN(TRIM(A2))

|  | A | B | C |
| --- | --- | --- | --- |
| 1 | Name |  | **9** |
| 2 | Anna Berg |  | |

## **Practice TRIM**

- [**1****Fix messy names with PROPER and TRIM**→](https://practiceexcelonline.com/practice/trim-proper-upper/proper-trim-clean-names)

## **Read the guide**

- [**Free Excel course online: learn Excel from your first formula to job-ready**](https://practiceexcelonline.com/learn/how-to-learn-excel)
- [**How to clean data in Excel with formulas**](https://practiceexcelonline.com/learn/clean-data-in-excel)

## **Related functions**

- [**LEN**](https://practiceexcelonline.com/functions/len)
- [**SUBSTITUTE**](https://practiceexcelonline.com/functions/substitute)
- [**PROPER**](https://practiceexcelonline.com/functions/proper)

```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/trim#webpage","@type":"WebPage","description":"How to use TRIM in Excel and Google Sheets: remove extra spaces that break lookups and comparisons.","name":"TRIM function in Excel: syntax and examples","url":"https://practiceexcelonline.com/functions/trim","breadcrumb":{"@id":"https://practiceexcelonline.com/functions/trim#breadcrumb"},"isPartOf":{"@id":"https://practiceexcelonline.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://practiceexcelonline.com/functions/trim"]}],"primaryImageOfPage":{"@id":"https://practiceexcelonline.com/#logo"}},{"@id":"https://practiceexcelonline.com/functions/trim#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":"TRIM function in Excel: syntax and examples","position":3}]},{"@id":"https://practiceexcelonline.com/functions/trim#article","description":"How to use TRIM in Excel and Google Sheets: remove extra spaces that break lookups and comparisons.","headline":"TRIM function in Excel: syntax and examples","inLanguage":"en-US","thumbnailUrl":"https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~VFJJTSBmdW5jdGlvbiBpbiBFeGNlbDogc3ludGF4IGFuZCBleGFtcGxlcw%2Cdescription_~SG93IHRvIHVzZSBUUklNIGluIEV4Y2VsIGFuZCBHb29nbGUgU2hlZXRzOiByZW1vdmUgZXh0cmEgc3BhY2VzIHRoYXQgYnJlYWsgbG9va3VwcyBhbmQgY29tcGFyaXNvbnMu%2Ceyebrow_Excel%2Bfunctions%2Csite_practiceexcel%2Ccode_TRIM(text)%2Cp_Ii9mdW5jdGlvbnMvdHJpbSI%2Cs_Eerz7PUetJKDLqrq.png","@type":["Article","TechArticle"],"author":{"@id":"https://practiceexcelonline.com/#identity"},"image":{"@id":"https://practiceexcelonline.com/#/schema/image/1"},"isPartOf":{"@id":"https://practiceexcelonline.com/functions/trim#webpage"},"mainEntityOfPage":{"@id":"https://practiceexcelonline.com/functions/trim#webpage"},"publisher":{"@id":"https://practiceexcelonline.com/#identity"}},{"@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_~VFJJTSBmdW5jdGlvbiBpbiBFeGNlbDogc3ludGF4IGFuZCBleGFtcGxlcw%2Cdescription_~SG93IHRvIHVzZSBUUklNIGluIEV4Y2VsIGFuZCBHb29nbGUgU2hlZXRzOiByZW1vdmUgZXh0cmEgc3BhY2VzIHRoYXQgYnJlYWsgbG9va3VwcyBhbmQgY29tcGFyaXNvbnMu%2Ceyebrow_Excel%2Bfunctions%2Csite_practiceexcel%2Ccode_TRIM(text)%2Cp_Ii9mdW5jdGlvbnMvdHJpbSI%2Cs_Eerz7PUetJKDLqrq.png","inLanguage":"en-US","url":"https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~VFJJTSBmdW5jdGlvbiBpbiBFeGNlbDogc3ludGF4IGFuZCBleGFtcGxlcw%2Cdescription_~SG93IHRvIHVzZSBUUklNIGluIEV4Y2VsIGFuZCBHb29nbGUgU2hlZXRzOiByZW1vdmUgZXh0cmEgc3BhY2VzIHRoYXQgYnJlYWsgbG9va3VwcyBhbmQgY29tcGFyaXNvbnMu%2Ceyebrow_Excel%2Bfunctions%2Csite_practiceexcel%2Ccode_TRIM(text)%2Cp_Ii9mdW5jdGlvbnMvdHJpbSI%2Cs_Eerz7PUetJKDLqrq.png"}]}
```

## Sitemap

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