How do I sort with spaces? I have spaces between my numbers and dates and names and would like to sort them without using a VBA formula.


You can use the TRIM and CLEAN functions to remove unneeded spaces and store the result in a separate column. After that, use the new column to sort. (See the TechNet article Formula Watch: TRIM and CLEAN your Excel data.)

(Image source: TechNet)

If needed, simply hide the temporary column or delete it completely after sorting

  • @ Gypsy Spellweaver: Thanks for your diligent work on our http images problem, and congratulations on your progress on Super User.  (I seem to recall that it took me way longer than two months to accrue my first 1000 rep points.)  I’m glad to see that you’re using some clever Markdown tricks.  FYI, see the above for a slight improvement on your technique — you don’t need to have the empty [] brackets after an eponymous link like [TRIM]. – G-Man Says 'Reinstate Monica' Apr 7 '17 at 19:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.