User Defined Format for Calc

I have a column that I want to reformat as ‘10-24211-132-970’ adding the dashes as shown when a number is added to that column such as ‘1024211132970’. I have read online documentation but cannot see how to do this. I manually edit the number each time putting the dashes in the right places but would like to apply a format to do that.

I am on a Mac using LO 24.2.5.2

Select the column, click Format > Cells > Numbers and at the bottom under Format Code paste ##"-"#####"-"###"-"### then click OK.
If you paste a string into a cell, make sure you paste it as unformatted text, Edit > Paste Special > Paste unformatted text Ctrl+Alt+Shift+V

More information on number formats in help, Number Format Codes

1 Like

Ok, this did not work. It worked when working on the cell, but when I saved the file and reopened L it does not work properly.

I setup a user defined format as by manually typing this in not copy & paste:

0#”-“#####”-“###”-“###

Leading zero is marked as 1

This works perfectly, and I save my file.

When I open that file, LO has changed the format to:

#”-“#####”-“###”-“##0

Which is not the format I want and does not work properly.

If I format as:

##”-“#####”-“###”-“###

Leading zero is marked as 1

The leading zero is dropped.

What am I doing wrong?

I am on LO 24.2.5.2 on macOS Apple M2 Sonoma 14.6.1

0#”-“#####”-“###”-“### makes no sense. For the whole part of a number, it’s impossible to only output 13th digit from right (trillions?), but not the digits of lesser magnitude. Note that, as explained in Help, 0 code differs from # in one detail: 0 place is always output, while # is only output when it is not zero and significant. All digits of the whole part are significant, when there is anything to the left of them. In the whole part, # only makes sense to the left of the leftmost 0.

So your format could be something like

00"-"00000"-"000"-"000

Changed it to this. Saved my document & reopened the document and it held. Close again and restarted my system and it held so thank you for being kind and sticking wit me in my utter confusion.