MS Excel: TRIM() Function

Microsoft’s Excel has a function called TRIM(), this function can be used to Prune leading and trailing spacing from a string

Understanding the way Excel uses TRIM()

This formula required 1 input; STRING.

The formula is as follows:


Using TRIM()

If I had the string ” Ian Blott, Web Developer, Sydney Australia ” in cell A1 and I wanted to remove the spaces at the start and end of the string


This would return the value “Ian Blott, Web Developer, Sydney Australia”

This post is going somewhere, Dont worry about that. A week or so ago I posted about the SEARCH() function in MS Excel and I was searching for the locations of commas in a string.

As the english language works, there is almost allways a space after a comma in a string of text. When I was using the fancy part of the SEARCH() to do saerches within a search I was getting returning strings that would contain preceeding spaces ” Web Developer, Sydney Australia”. This is where the TRIM() function came in handly.

Getting Fancy

Ultimately the TRIM() function really only lends itself to one basic task. So getting fancy isn’t really something this guy can do.

Side note:

As with all my posts, quite often they are going somewhere and require 2,3 or even 4 different functions to perform the final task. Bellow are the related posts that tell an overall story

Leave a Reply