Excel – How to insert a space between text and numbers in one cell

microsoft excel

I need to add a space in between text and numbers. For example, I want to change MS1-27 to MS 1-27 while keeping the data in one cell. How can I do this in Excel?

Best Answer

I'm not sure what you mean by "keeping the data in one cell".

A formula requires putting the formula in a different cell. For example:

=TRIM(REPLACE(A1,MIN(FIND({1,2,3,4,5,6,7,8,9,0},A1&"1234567890")),0," "))

will place a space before the first digit. The TRIM wrapper is in case there already is a space.

If you need to have it happen within the cell, you will need a VBA Macro as a formula cannot alter the contents of a different cell.

Related Question