Ask Your Question
0

align decimal points

asked 2019-12-28 00:53:56 +0200

chiropterist gravatar image

updated 2020-08-07 20:06:48 +0200

Alex Kemp gravatar image

Here is an brief excerpt from a column in a Calc spreadsheet. The numbers in the example are meaningless; they serve only to illustrate the problem:

1.7 g per 1/4 cup
25.9 C per 1/4 cup
4 portions per cup

These cells are formatted as follows:

0.0" g per 1/4 cup"
0.0" C per 1/4 cup"
0" portions per cup"

See a screenshot of the CELL FORMATTING and RESULT at

C:\fakepath\Decimal Alignment Example.PNG.

How can I format the cells so the decimal points are aligned?

I understand that I can insert spaces of varying widths immediately after the number by using _m, _i, and so forth, but I am looking for something less klugey.

Any suggestions?

(edit: activated screenshot)

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2019-12-28 01:19:43 +0200

updated 2019-12-28 01:21:42 +0200

You could do this using ? format code described on this help page:

The ? works as the # but adds a space character to keep decimal alignment if there is a hidden non-significant zero.

You might change your format strings to be:

???0.0" g per 1/4 cup"
???0.0" C per 1/4 cup"
???0" portions per cup"

(I guessed you might use 4 digit numbers, but you can adjust to your needs), align cells to the left, and use a monospace font (like Liberation Mono).

image description

edit flag offensive delete link more

Comments

Thanks Mike, That's just what I was looking for. Shame on me for not using a monospaced font from the get-go!

chiropterist gravatar imagechiropterist ( 2019-12-29 03:24:25 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-12-28 00:53:56 +0200

Seen: 486 times

Last updated: Aug 07 '20