Excel text alignment with custom formatting

While it is not possible to explicitly set the cell alignment using a custom format, you can achieve the same effect using the Repeat Characters syntax in the custom format. This syntax is simply the * character followed by the character that you want to repeat, in this case presumably the space character.

For example, the simple comma-separated number format "#,##0" can be made to align left by changing the format string to "#,##0* ".

Taking the example further, you could have number entries align left and text entries align right using the custom format string "#,##0* ;;;* @".