Trim should work. If you type =trim(a1), then that will remove all surrounding spaces around the data in A1.