EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Certification Courses
  • 120+ Courses All in One Bundle
  • Login
Home Excel Excel Resources TEXT and String Functions in Excel TRIM Formula in Excel
Secondary Sidebar
Excel Functions
  • TEXT and String Functions in Excel
    • Excel CODE Function
    • Excel Find
    • TRIM Formula in Excel
    • Excel CHAR Function
    • LEFT Formula in Excel
    • Opposite of Concatenate in Excel
    • Concatenate Strings in Excel
    • Extract Numbers From String
    • VALUE Formula in Excel
    • Left TRIM in Excel
    • Substring Excel Function
    • SUBSTITUTE Function in Excel
    • Excel VALUE Function
    • Excel REPT Function
    • Excel TRIM Function
    • Excel CLEAN Function
    • Excel EXACT Function
    • PROPER Function in Excel
    • Excel LEFT Function
    • MID Function in Excel
    • LEN Function in Excel
    • CONCATENATE Function in Excel
    • SEARCH Function in Excel
    • RIGHT Function in Excel
    • FIND Function in Excel
    • TEXT Function in Excel
  • Excel Functions (12+)
  • Excel Tools (114+)
  • Financial Functions in Excel (17+)
  • Logical Functions in Excel (14+)
  • Lookup and Reference Functions in Excel (36+)
  • Maths Function in Excel (47+)
  • Date and Time Function in Excel (24+)
  • Statistical Functions in Excel (59+)
  • Information Functions in Excel (4+)
  • Excel Charts (56+)
  • Excel Tips (220+)
  • Workplace Productivity (4+)
  • Microsoft Office Tools (15+)
  • Excel Formula and Functions (22+)
  • MS Excel Shortcuts (4+)
Excel Functions Courses
  • EXCEL ADVANCED Online COURSE
  • Online Excel Data Analysis Training

TRIM Formula in Excel

By Madhuri ThakurMadhuri Thakur

TRIM Formula in Excel

Excel Trim Formula (Table of Contents)

  • Introduction to TRIM Formula in Excel
  • How to Use TRIM Formula in Excel?

Introduction to TRIM Formula in Excel

The trim function comes under the list of string/text functions in excel. This built-in function helps us to remove unwanted spaces within the data. The trim function returns data after removing unnecessary spaces. This can be prior to a word or space following a text. This function helps to clean your data which causes errors and difficult to detect.

Start Your Free Excel Course

Excel functions, formula, charts, formatting creating excel dashboard & others

Syntax of TRIM Formula 

TRIM Syntax

Argument of TRIM Formula:

The text refers to a cell or text.

How to Use TRIM Formula in Excel?

The trim function helps us remove the unwanted spaces between words in a string, numbers, etc. this unwanted spaces may cause to produce wrong results when you apply a formula. The spaces may occur tailing to the data or prior to the data. This will affect data manipulation if it is numbers. And for texts, it may occur in between the words too. Let’s understand how to use the TRIM Formula in Excel with some examples.

You can download this TRIM Formula Excel Template here – TRIM Formula Excel Template

Example #1 – Find the Total of Purchased Amount

Let’s see how the extra spaces within the data make problems for you. Below is the list of items purchased. We want to find the total of the purchased amount.

NOTE: Consider the amount 12 is entered in Text format with space.
trim Formula in excel 1-1

Select the immediate next cell where the amount ends.

trim Formula in excel 1-2

And apply the formula to find the sum of amounts for 8 items.

trim Formula in excel 1-3

After using the formula, the answer is shown below.

trim Formula in excel 1-4

The formula applied is =SUM (B2: B9), the entire item amount is added. But the sum of the amount is wrong; some amounts are not added. While checking, it is found the first item’s amount is not added. By examining again, we found an unnecessary space trailing with the first amount.

trim Formula in excel 1-5

Until this extra space gets removed, it won’t produce the correct amount while applying the formula. To remove this space, apply the trim function as below. This will clear the data from unwanted spaces.

trim Formula in excel 1-6

By selecting cell C2, apply the formula as =TRIM(B2), and press Enter where C2 is the cell that contains the data with extra space with it.

trim Formula in excel 1-7

Copy and paste as values in cell C2 after the extra space is removed from the data. Now the unwanted space is removed, and the sum of amounts is changed as below.

trim Formula in excel 1-8

Here the total was 1032 when the formula is applied initially, but after removing the unnecessary spaces, it gave the correct result for the applied formula where the amount for 8 items is included.

Example #2 – Using COUNT & TRIM Function

Given is the list of loans issued by a bank, and the details include Loan_ID, Gender, Marital status, etc. We want to get the count of loan issued.

List of loans issued 2-1

Let’s try to apply the COUNT function to get the number of loans issued to the Loan_ID column.

COUNT function 2-2

Trim in Excel 2-3

Select the cell B8 and apply the formula =COUNT (A2:A8), then press Enter where A2:A8 contains the Loan_ID for each loan.

TRIM in excel 2-4

The result is shown as ‘0’ instead of 6. If you check the data given, an unwanted space can see before the Loan_ID.

COUNT trim

By using the trim formula, this unnecessary space can be removed. Since this space exists, the count function will never produce proper results. So select cell F2 and apply the trim formula for Loan_ID.

Applying the Trim Formula

After removing the unwanted spaces, you can see the applied formula is worked to find the count of loan. The number of loans granted is 6.

Count of Loan

Example #3 – Remove the Unwanted Spaces in String or Characters

Let’s see how the trim function can be used to remove the unnecessary spaces between the string data. Some survey questions are listed in an excel workbook, and the options are also mentioned.

Survey questions

You can see the data is scattered and unable to read it properly. It exits more spaces between the words and difficult to understand. By applying the trim function, see how the data can be aligned properly. Select C3 and apply the formula =Trim(B3)

TRIM Function in Excel 3-2

Press the Enter key and see how the unwanted spaces are replaced.

TRIM Function in Excel 3-3

Apply the TRIM formula to the entire cell, and the data will look as below.

TRIM Function in Excel 3-4

The scattered data is aligned properly, and now the options for the given question are easy to read.

Things to Remember

  • The trim function deletes spaces between words except for a single space.
  • If the strings contain unwanted spaces, it will be difficult to understand.
  • Unwanted spaces in the data will stop you from producing proper results while applying the formula.
  • For integers or number type data, the space prior to or tailing will affect on the data manufacturing.
  • The trim function will leave a single space between words in a string and remove extra spaces apart from this.
  • Trim clears ASCII character (32) from a text.

Recommended Articles

This is a guide to TRIM Formula in Excel. Here we discuss How to use TRIM Formula in Excel along with practical examples and a downloadable excel template. You can also go through our other suggested articles –

  1. Left TRIM in Excel
  2. Excel TRIM Function
  3. VBA TRIM
  4. LEFT Formula in Excel
Popular Course in this category
Excel Advanced Training (16 Courses, 23+ Projects)
  16 Online Courses |  23 Hands-on Projects |  140+ Hours |  Verifiable Certificate of Completion
4.8
Price

View Course

Related Courses

Excel Data Analysis Training (17 Courses, 8+ Projects)4.9
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Excel Charts
  • Excel Tips
  • All Tutorials
Certification Courses
  • All Courses
  • Excel VBA Course - All in One Bundle
  • VBA Course
  • Excel Data Analysis Course
  • Excel for Marketing Course
  • Excel for Finance Course
  • Excel for HR Training

ISO 10004:2018 & ISO 9001:2015 Certified

© 2023 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Excel Course

Excel functions, formula, charts, formatting creating excel dashboard & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

Download TRIM Formula Excel Template

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

Download TRIM Formula Excel Template

EDUCBA

डाउनलोड TRIM Formula Excel Template

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more