Try this
For one space
![]()
=TRIM(A2)
For two spaces
If you omit the last arguement from the above i.e. ,1 then all spaces will be replaced with double spaces, change it to ,2 and the second space will be doubled...etc![]()
=SUBSTITUTE(TRIM(A2)," ",REPT(" ",2),1)
Trim as a worksheet function removes all extra spaces in a string, unlike the VBa Trim which only removes leading and trailing spaces.
Hope this helps
Bookmarks