Bug Hunting Session
Bug 112891 - Add percent sign to a cell without recalculation
Summary: Add percent sign to a cell without recalculation
Status: CLOSED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.4.1.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:6.0.0
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-05 09:48 UTC by Daniel
Modified: 2018-01-28 11:01 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
screenshot user defined cell formatting (72.89 KB, image/png)
2018-01-19 19:34 UTC, Xavier Van Wijmeersch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel 2017-10-05 09:48:28 UTC
Description:
Using calc I can't just add the sign percent without calcule the new number.

Steps to Reproduce:
1. Write a decimal number
2. Try to add % sign (in all ways)
3. it always add 2 more decimals

Actual Results:  
it add always 2 decimals, but I just stablish that cell with percent format, not to calculate new operation.

Expected Results:
Should have an option to not modify the decimals and just add the % sign

I tried in format cell section with not results

I tried in deleting decimals button when Percent button is activated, nothing.

If I select that cells as percent format, at least, should remove the decimals, but I can't or just add the % sign without to do anymore.


Reproducible: Always

User Profile Reset: No

Additional Info:


User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0
Comment 1 Xisco Faulí 2017-10-06 08:39:51 UTC
You can't confirm your own bugs. Moving it back to UNCONFIRMED until someone else confirms it.
Comment 2 Daniel 2017-10-06 08:47:19 UTC
(In reply to Xisco Faulí from comment #1)
> You can't confirm your own bugs. Moving it back to UNCONFIRMED until someone
> else confirms it.

sorry, my bad, it's the first time I use bugzilla
Comment 3 Xavier Van Wijmeersch 2017-10-07 07:35:10 UTC
reproduce with

Version: 6.0.0.0.alpha0+
Build ID: 141fe1c5e7fbf67a083b34e49e19b6ea78a0eb2b
CPU threads: 8; OS: Linux 4.9; UI render: default; VCL: kde4; 
Locale: nl-BE (en_US.UTF-8); Calc: group

Version: 5.4.3.0.0+
Build ID: cc70f137cd853bc22281edb94f15ebe48da871e7
CPU threads: 8; OS: Linux 4.9; UI render: default; VCL: kde4; 
Locale: nl-BE (en_US.UTF-8); Calc: group

Version: 5.3.8.0.0+
Build ID: a0fae00a2d52960eebbb14f08d2de251e0a8ff3f
CPU Threads: 8; OS Version: Linux 4.9; UI Render: default; VCL: kde4; Layout Engine: new; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:libreoffice-5-3, Time: 2017-10-05_05:58:12
Locale: nl-BE (en_US.UTF-8); Calc: group

Version: 5.3.1.2
Build ID: e80a0e0fd1875e1696614d24c32df0f95f03deb2
CPU Threads: 8; OS Version: Linux 4.9; UI Render: default; VCL: kde4; Layout Engine: new; 
Locale: nl-BE (en_US.UTF-8); Calc: group
Comment 4 Commit Notification 2017-10-18 19:44:41 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3db8059cd92545a618e6ec349b090b569c60847d

Resolves: tdf#112891 give restart dialog a parent

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Daniel 2017-10-24 21:28:14 UTC
I just tried, it works if you put a normal number in a cell and you add the % sign, but it doesn't if in this cell there is a function before.


So imagine there is a SUM in B2 which I want to put that number in percent, but I don't want to calculate the percent of that, because that value is the percent itself and I just want to add the % sign.

Any solution?
Comment 6 Xisco Faulí 2017-11-24 18:09:55 UTC
Hi Caoĺán,
Is your commit intended to fix this issue or is it just a typo in the commit message ?
Comment 7 saran.chava143 2018-01-14 06:22:45 UTC
Hello! I am a newbie in bug fixing, Can please help me in fixing this bug?
Comment 8 Xavier Van Wijmeersch 2018-01-14 19:23:09 UTC
@Daniel

=SUM(A1/A2)&"%" this can help ==> about your question in comment5 or you can use cell formatting
Comment 9 Daniel 2018-01-19 10:31:45 UTC
(In reply to Xavier Van Wijmeersch from comment #8)
> @Daniel
> 
> =SUM(A1/A2)&"%" this can help ==> about your question in comment5 or you can
> use cell formatting

Formating cells sucks with percent because it doesn't reduce decimals up to get 1 or 2.

The formula that I have in the percent cell is:

=100-(H29*100/K29) that gives me the percent number (without the percent sign). That result is 25,25 if I add to the formula 100-(H29*100/K29)&"%" it gives me 
25,2513275617276% which is not practical at all, so the temporal solution that I'm using is to write in the right cell the % sign and align to the left, but that's not profesional at all.
you can check that it's impossible to delete a decimal if you press the button delete decimals, and also in formatting cells.

I'm still waiting a nice solution :(
Comment 10 Xavier Van Wijmeersch 2018-01-19 19:34:54 UTC
Created attachment 139224 [details]
screenshot user defined cell formatting

@Daniel

Ok the solution i provided is not a good one, but with direct cell formatting you can have the result you want. Select a cell and ctrl+1. You will the have the format cell dialog. On the tab number in category number and select the options decimal places, set 2. In the format code place something like #,##" %". See the screenshot.
Comment 11 Eike Rathke 2018-01-23 12:44:29 UTC
(In reply to Daniel from comment #9)
> =100-(H29*100/K29) that gives me the percent number (without the percent
> sign). That result is 25,25
To only display that number with an appended percent sign you can use a number format such as
0,00"%"  or  #,##" %"  as indicated by Xavier.
Note the enquoted percent sign which makes it a string without

Otherwise change your calculations to actually calculate in percentages by simply adding the % percent operator, so
=(100-(H29*100/K29))%
which divides the result by 100 and if the cell has the General format also automatically applies the percent number format
Comment 12 Daniel 2018-01-28 11:01:28 UTC
Thank you Xavier, that answer worked perfect for me. (Sorry for not have answered before, I'm having problem with the notifications despite I've indicated not to mark them as spam)

Is it possible to add this solution prefixed to the formating cell window? It would be more comfortable for other users, instead of writing the format code.