Number formatting with %

Discuss the spreadsheet application
Post Reply
shiftyness13
Posts: 4
Joined: Sun Jul 26, 2015 8:51 pm

Number formatting with %

Post by shiftyness13 »

I'm trying to setup a format code for numbers so that it rounds to one decimal place, but not if they are whole numbers. After some research, I found that the format code #.#;0 accomplishes this. However, when I try to do the same thing with %, it gets a bit weird. I tried both #.#%;0% and 0%;#.#% , and it seemingly will only use whichever one comes first. I'm admittedly fairly new to the program though, so it's very possible I'm missing something pretty obvious. I apologize if that's the case.
OpenOffice 4.1.1
Windows 7 Home Premium SP1
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Number formatting with %

Post by Villeroy »

Value ... Formatted as percent:
25 ... 2500%
1 ... 100%
2 ... 200%
0.5 ... 50%
0.025 ...2.5%
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
RusselB
Moderator
Posts: 6646
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON

Re: Number formatting with %

Post by RusselB »

In order to have multiple possible formats for a single cell, you need to use the Conditional Brackets, as described in the Help file under format codes;numbers
You'll have to experiment with the details to get the exact formatting you want for specific numbers.
OpenOffice 4.1.7, LibreOffice 7.0.1.2 on Windows 7 Pro, Ultimate & Windows 10 Home (2004)
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
shiftyness13
Posts: 4
Joined: Sun Jul 26, 2015 8:51 pm

Re: Number formatting with %

Post by shiftyness13 »

RusselB wrote:In order to have multiple possible formats for a single cell, you need to use the Conditional Brackets, as described in the Help file under format codes;numbers
You'll have to experiment with the details to get the exact formatting you want for specific numbers.
Thanks, I'll look into that. Out of curiosity though, why does it work with standard numbers when I use multiple formats seperated by a semi-colon, but not when I add % into it?
OpenOffice 4.1.1
Windows 7 Home Premium SP1
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Number formatting with %

Post by Villeroy »

"Does not work" is not a valid problem description.
What do you enter?
What do you expect to see?
What is displayed instead?
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
shiftyness13
Posts: 4
Joined: Sun Jul 26, 2015 8:51 pm

Re: Number formatting with %

Post by shiftyness13 »

Villeroy wrote:"Does not work" is not a valid problem description.
What do you enter?
What do you expect to see?
What is displayed instead?
0 with the format code 0%;#.#% turns up: 0%
This is what I'd like, but I believe it's working like that only because of the first part of the format code before the semi-colon.

0 with the format code #.#%;0% turns up: .%
Obviously that looks a bit silly. It seems to be for the same reason, where it's only taking into account the #.#%, and nothing after the semi-colon.

.3333(repeating) with the format code 0%;#.#% turns up: 33%

.3333(repeating) with the format code #.#%;0% turns up: 33.3%
Behaving the same way as it did with 0. I'd like a way to apply a single format code to all the cells in this column that works. However, 33.3% and 0% (the two results I want in this case) require different codes, out of what I've come up with at least.

As for what I expected to see, I thought it would work the same was as those formats would if there was not a % involved. The format code #.#;0 is able to give me both 4 and 13.1, rather than turning 4 into 4.0 or turning 13.1 to 13.
OpenOffice 4.1.1
Windows 7 Home Premium SP1
User avatar
Zizi64
Volunteer
Posts: 11359
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Number formatting with %

Post by Zizi64 »

Out of curiosity though, why does it work with standard numbers when I use multiple formats seperated by a semi-colon, but not when I add % into it?
Please upload your example .ods file here - with some formatted values (and those format codes)...
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
shiftyness13
Posts: 4
Joined: Sun Jul 26, 2015 8:51 pm

Re: Number formatting with %

Post by shiftyness13 »

Zizi64 wrote:
Out of curiosity though, why does it work with standard numbers when I use multiple formats seperated by a semi-colon, but not when I add % into it?
Please upload your example .ods file here - with some formatted values (and those format codes)...
It's a mess for now of course, but C2-4 is where the format codes I can't figure out are meant to be. F,G, and H 2-4 are where the non-% format codes are working as expected and as desired.
Attachments
ARAM Stats.ods
(14.72 KiB) Downloaded 62 times
OpenOffice 4.1.1
Windows 7 Home Premium SP1
Post Reply