WallStreetMojo

WallStreetMojo

WallStreetMojo

MENUMENU
  • Free Tutorials
  • Certification Courses
  • Excel VBA All in One Bundle
  • Login
Home » Excel, VBA & Power BI » Excel Tutorials » Trim in Excel

Trim in Excel

Trim Function in Excel

Trim function in excel as the name suggests itself it trims some part of any string, why string because it is a text function, the function of this formula is that it removes any space in a given string but it does not remove if there is a single space is present between two words but any other unwanted spaces are removed.

TRIM Formula in Excel

TRIM Formula

The trim formula in Excel has only one compulsory parameter, i.e., text.

  • text: it is a text from which you want to remove extra spaces.

How to Use TRIM Function in Excel?

TRIM function in excel is very simple and easy to use. Let us understand the working of the TRIM function in Excel by some examples. Excel Trim function can be used as a worksheet function and as a VBA function.

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

Example #1

In this example, the trim function in excel is used to remove the extra spaces from the give texts/ words from the beginning and at the end.

And the result will be in the second column. Applying trim on “Tanuj,” the output will be “Tanuj” =TRIM(B5).

Popular Course in this category
Sale
All in One Excel VBA Bundle (35 Courses with Projects)
4.9 (1,353 ratings)
35+ Courses | 120+ Hours | Full Lifetime Access | Certificate of Completion
View Course

TRIM Example 1

Example #2

In this example, the trim removes the extra spaces from the middle of the given text string, as shown in the below table.

TRIM Example 2

For “Note that the        Trim function is similar to” =TRIM(B19), the output will be “Note that the Trim function is similar.”

Example #3

Suppose you need to calculate the number of words in the string –“Note that the Trim function is similar” you can use =LEN(B31)-LEN(SUBSTITUTE(B31,”,”))+1. It will count the number of spaces and add one to it.

But if there are extra spaces between the string, then it will not work, so we use trim to achieve it. Here we use the =LEN(TRIM(B32))-LEN(SUBSTITUTE(B32,” “,”))+1 function. This will first remove extra spaces, then count the number of spaces and add one to give the total number of words in the string.

TRIM Example 3

Example #4

To join the multiple columns separated with comma, we can use the trim function and substitute function in excel.

Trim will be =SUBSTITUTE(TRIM(F5&” “&G5&” “&H5&” “&I5),” “,”, “).

TRIM Example 4

Things to Remember

The TRIM function removes extra spaces from the text and leaves no extra space b/w words and no beginning and end space at the string.

  • TRIM Function is only able to remove the ASCII space character (32) from text/string.
  • Trim in excel is not able to remove the Unicode text often contains a non-breaking space character (160) that appears in web pages as the HTML entity.
  • TRIM in excel is very useful to clean the text from other applications or environments.

Trim in Excel Video

Recommended Articles

This has been a guide to TRIM Function in Excel. Here we discuss the TRIM Formula in excel and how to use the TRIM Excel function along with excel example and downloadable excel templates. You may also look at these useful functions in excel –

  • VBA TRIM in Excel
  • POWER Function
  • NOT Excel Function
  • Concatenate in Excel
  • Percentage Change Formula in Excel
2 Shares
Share
Tweet
Share
All in One Excel VBA Bundle (35 Courses with Projects)
  • 35+ Courses
  • 120+ Hours
  • Full Lifetime Access
  • Certificate of Completion
LEARN MORE >>
Primary Sidebar
Footer
COMPANY
About
Reviews
Contact
Privacy
Terms of Service
RESOURCES
Blog
Free Courses
Free Tutorials
Investment Banking Tutorials
Financial Modeling Tutorials
Excel Tutorials
Accounting Tutorials
Financial Statement Analysis
COURSES
All Courses
Financial Analyst All in One Course
Investment Banking Course
Financial Modeling Course
Private Equity Course
Venture Capital Course
Excel All in One Course

Copyright © 2021. CFA Institute Does Not Endorse, Promote, Or Warrant The Accuracy Or Quality Of WallStreetMojo. CFA® And Chartered Financial Analyst® Are Registered Trademarks Owned By CFA Institute.
Return to top

WallStreetMojo

Free Excel Course

Excel functions, Formula, Charts, Formatting creating excel dashboard & others

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

Book Your One Instructor : One Learner Free Class
Let’s Get Started
Please select the batch
Saturday - Sunday 9 am IST to 5 pm IST
Saturday - Sunday 9 am IST to 5 pm IST

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

WallStreetMojo

Free Excel Course

Excel functions, Formula, Charts, Formatting creating excel dashboard & others

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

Login

Forgot Password?

WallStreetMojo

Download TRIM Function Excel Template

New Year Offer - All in One Excel VBA Bundle (35 Courses with Projects) View More