How to Remove Leading and Trailing Spaces in Excel?


Spaces can frequently accidentally enter your data, leading to discrepancies and problems with many Excel functions. Cleaning up the unnecessary spaces is crucial for precise and effective data analysis, whether you're working with names, addresses, or any other type of data.

Extra leading and trailing spaces are removed from a text string using the TRIM function. Only extra spaces before the first character and after the last character are affected; single spaces between words are unaffected. In this article, we'll go through a variety of techniques for finding and getting rid of leading and trailing spaces in Excel worksheets. By the end of this book, you'll be equipped with the skills and resources necessary to organise your data so that it's neat and prepared for additional analysis or reporting.

Remove Leading and Trailing Spaces

Here we will first get any one of the results using the formula, then use the autofill handle to complete the task. So let us see a simple process to learn how you can remove leading and trailing spaces in Excel.

Step 1

Consider an Excel sheet where you list strings with leading and trailing spaces.

First, click on an empty cell and enter the formula as =TRIM(A2) and click enter to get the first value. In the formula, A2 is the address of the cells containing the data.

Empty cell > Formula > Enter.

Step 2

Then drag down using the autofill handle to complete the task.

This is how you can remove leading and trailing spaces in Excel.

Note  The formula will remove all the spaces, like trailing spaces, leading spaces, and even extra spaces, in the cell.

Conclusion

In this tutorial, we have used a simple example to demonstrate how you can remove leading and trailing spaces in Excel to highlight a particular set of data.

Updated on: 08-Sep-2023

57 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements