I have a Cognos-8 based report which has several number columns. I have set the decimal separator for these columns explicilty as
Number
Decimal Places: 2
Decimal Separator: period (.)
Negative number symbol: ()
When I run the report in the English locale, all the columns display the output correctly , for eg: 1.20, 30.33, (3.30)
When I run the report in the French locale, the negative number outputs are displayed with a separator comma(,) instead of period (.). What could be causing this and how can I set the separator to comma in French locale?
Please help.
Found the solution.
I set the report to the negative conditional variable for each column and then set the separator as period.This fixed it.
Related
How does excel determine what to number to display? specifically the number of decimal places
for example:
50.98, when stored as a single-precision float is 50.979999542236328125
50.979999 is also stored as the exact same single-precision float
(binary rep. 01000010010010111110101110000101, taken from here: https://www.h-schmidt.net/FloatConverter/IEEE754.html)
when i type 50.98 & 50.979999 into 2 cells, change format to number, and extend out the decimal places using the formatting button
it represents them exactly as 50.98 & 50.979999, as i originally typed.
how is that working? is excel storing the exact text i typed and not (directly) storing the float data type at all?
if it stores it as a double, how does it preserve the exact precision i originally typed in that case?
i can't find documentation outlining how this works.
Note its not causing me any problems, i just need an explanation for differences in how excel displays vs calculations based on those values.
it represents them exactly as 50.98 & 50.979999, as i originally typed.
Excel is padding with zeros after 15 significant decimal digits.
The internal number is encoded with a high enough binary precision such that limiting output to 15 deimcal places, the original typed in decimal values appear to be exactly that.
=2/3 is an informative example showing this limit and exposing the binary internals by carefully extracting out a bit at a time.
As displayed in one cell, decimal output rounds to 15 places, padding with zero after that.
0.66666666666666700000000
The below does a binary conversion of =2/3 and forms 0.101010101010101010101010101010101010101010101010101012, exactly what is expected if Excel used a binary64. (Below)
OP's observations are consistent with using binary64 and rounding output as decimal text to 15 significant digits.
Cell A3: =FLOOR(B2*A$1,1), Cell B3 = =B2*A$1 - A3
Hypothesis: When displaying a number, Excel first converts a number to a decimal numeral with at most 15 significant digits even if more are requested. If additional digits are requested, they are filled in as zeros. (In addition, Excel may apply other alterations depending on context.)
In Microsoft Excel 2008 for Mac, I entered =1+22*POWER(2,-52) in A1 and =1+23*POWER(2,-52) in A2. Using IEEE-754 binary64, these should generate the numbers 1.000000000000004884981308350688777863979339599609375 and 1.0000000000000051070259132757200859487056732177734375. Entering =A1-1 and =A2-1 in B1 and B2 and setting these to Number format with 30 decimal places shows “0.000000000000004884981308350690” and “0.000000000000005107025913275720”, which is consistent with IEEE-754 binary64. So we have some assurance the numbers above were indeed generated and stored in Excel.
Setting A1 and A2 to Number format with 20 decimal places shows “1.00000000000000000000” and “1.00000000000001000000”.
Clearly, if Excel were displaying the actual numbers with 20 decimal places, it would show “1.000000000000004885” and “1.000000000000005107”. It does not. The display we see is consistent with converting the numbers using 15 decimal digits (significant digits, not just those after the decimal point) and then padding with zeros.
Converting 50.98 to the IEEE-754 binary64 format yields 50.97999999999999687361196265555918216705322265625. Displaying this with 15 decimal digits yields 50.9800000000000.
When I paste a time with milliseconds like this 21:34:58.342 into excel, it does not get converted into time format and is stored as text instead. I've tried converting it manually by means of =--TEXT(A1;"hh:mm:ss.000") but it produces #VALUE! error.
How do I convert time with milliseconds text to time format?
Update
If I paste 21:34:58 the value is converted into Time correctly. If I apply h:mm:ss.000 format to the resulting cell the value is displayed as 21:34:58.000. But if I edit the cell and add a millisecond to the value 21:34:58.001 it becomes Text.
Most likely, your system (see Windows Regional Settings) decimal separator is not a dot. You need to use your system decimal separator when you enter the millisecond value. Most likely, that is a comma. You may need to use your system decimal separator in your format string also.
I import data from web external query in excel in which zero value represented as dash, to further calculation on this I need to consider this dash as zero
for that I have macro to convert dash to zero but, data gets refreshed every 5 min. so I need to run that replacement macro every 5 min.
instead of this I want to do is,apply format cell in which dash will be considered as zero and I will import data by selecting preserve format, so no need to run replacement macro every 5 min.
So pls let me know custom format cell in which positive value ll be consider as positive,negative as negative but dashes as zero
thank you.
In your custom format cell use the following format: #;-#;"-";#
It decomposes as positive numbers; negatives; nul value; any text.
I Commonly use: #,00;-#,00;"-";# to set get 2 digit precision.
Access format cells with right click > Format Cells... > tab Number > Category custom
I've got a value of [HH]:MM:SS that is 76:30:00. I'd like to convert this value to a decimal value of the 'number' of hours - in this case 76.5.
However HOURS() returns 4 instead of 76. Probably because (3*24 + 4)=76
I'm using Libre Office Calc - but I assume it would be the same solution with Excel.
Depending on your regional settings this works at least in excel...
American, with regional settings "hh:mm:ss" and delimiter ","
=TEXT(H15,"[h]:mm:ss")*24
European, with regional settings "tt:mm:ss" and delimiter ";"
=TEXT(H15;"[t]:mm:ss")*24
Excel stores dates/times as days and fractions of a day, usually since 1/1/1900.
So all you need to do is multiply your time value by 24, and format the result as General or as Number with 1 (or more) decimals.
I want to format a number with two decimals unless it's 0. Can I do this?
123.93
23.00
144.34
0
2.38
This works great:
Go to format cells and select custom. Then paste this 0.00;[=0]0 into the Type field
from http://www.ozgrid.com/Excel/CustomFormats.htm
Try this:
=IF(A1=0,"0",TEXT(A1,"0.00"))
An alternative that includes a separator for thousands, shows negative values in red font and aligns zeros with whole numbers:
#,##0.00;[Red]-#,##0.00;0
(for the alignment, there are three blanks at the end).
From Excel Help:
A number format can have up to four sections of code, separated by
semicolons. These code sections define the format for positive
numbers, negative numbers, zero values, and text, in that order.
;;;
So All you really need to do is something like 0.00,-0.00,0