Calc - leading-zeros - how to set them - and turn them into text (for use when sorting etc.)

There are various circumstances when you may want to have leading zeros and permanently add them to the original numbers; the following steps explain how to do this.

[1] Select the column containing the numbers to which you want to add “Leading zeros”.

[2] Open the “Format Cells” dialogue e.g using the key-combination “Ctrl” + “1”.

[3] Click on the “Numbers” tab.

[4] The controls for adding Leading zeros is in the section “Options”, near the bottom of the dialogue-window.

[5] Add the number of leading zeros you require e.g. if “8” needs to be “008” you must set the value of “Leading zeros” to 3. Click on “OK”.

[6] The numbers in the column you selected in step [1] will now appear in the Calc spreadsheet with leading zeros. However, if you select any given cell and then look at what is displayed in the “Formula bar” you will see that the value displayed in the Formula bar does not have the leading zeros.

[7] Now to permanently add the leading zeros to the original numbers.

[8] Select the column containing the numbers to which you have already added the leading zeros. Press the following key-combination “Ctrl” + “c” to copy the column’s content into the clipboard.

[9] Select an empty column to which you wish to add your “numbers-with-leading-zeros” and press the following key-combination “Ctrl” + “shift” +“Alt” + “v”. This opens the “Text Import” dialogue.

[10] Under the section “Fields” at the bottom of the window you will see a small display of the numbers you are copying. Click on the title (heading) of the column to select it.

[11] Just above the displayed column which you have selected in step [10] is a drop-down-menu “Column type”. Click on this and select “Text”. Click on “OK”.

[12] Save your spreadsheet.

I hope this short guide helps you. :slightly_smiling_face:


Version: 7.5.2.2 (X86_64) / LibreOffice Community
Build ID: 53bb9681a964705cf672590721dbc85eb4d0c3a2
CPU threads: 4; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-GB (en_GB.UTF-8); UI: en-GB
Flatpak
Calc: threaded

Or at step
[8] Select the column and in the menu click Data > Text to Columns. In the dialogue click the column label Standard then in field Column Type select Text. OK
Cheers, Al :slightly_smiling_face: