Excel Guides

Trimming Spaces from Strings in Excel

When working with strings in Excel, it is often necessary to remove leading and trailing spaces in order to clean up the data. This can be done using the TRIM function. The TRIM function takes a string as an argument and returns the string with all leading and trailing spaces removed.

To use the TRIM function, simply enter =TRIM(string) into a cell, where string is the cell reference or string value that you want to trim. For example, if cell A1 contains the string " hello world ", the formula =TRIM(A1) would return "hello world".

If you need to remove more than just leading and trailing spaces, you can use the CLEAN function. The CLEAN function takes a string as an argument and returns the string with all non-printable characters removed. Non-printable characters include things like tabs, line breaks, and other control characters. To use the CLEAN function, simply enter =CLEAN(string) into a cell.

Move beyond 

Excel

Get started with Causal today.
Build models effortlessly, connect them directly to your data, and share them with interactive dashboards and beautiful visuals.