Home > Enterprise >  How can a column be set to display multiple spaces and tabs (white space) in a cell?
How can a column be set to display multiple spaces and tabs (white space) in a cell?

Time:01-19

One column in my Excel spreadsheet contains data that includes spaces and tabs (screenshot below). Excel, however, does not display the tabs and spaces, so the data loses visual structure. When I double-click on the cell, however, Excel seems to change to a "preview mode" for the cell and does display the tabs and spaces (screenshot below).

Is there a way to tell Excel to display that data with the spaces and tabs by default (without having to double-click on a cell)? Thanks!

Default view:

enter image description here

View if I double-click on this same cell (tabs and spaces are displayed by Excel, like I need by default):

enter image description here

CodePudding user response:

I was able to sort of replicate your issue by typing your "code" in Word and then copying it over. Even if you format the cell as "Text", the indentation is gone. To my knowledge, there is no way to force Excel not to do this, because what you are copying over is not plain text.

You have two options here: replace your tabs with spaces, as has been suggested in a comment, OR - and this would be the preferred solution for me - write the code in something like Comparison of three cells containing code

The reason I would recommend a tool like Visual Studio Code is simple - it is made for the job, where Word introduces all sorts of weird stuff, which produces the results you have been seeing.

  • Related