I want to edit my decimal number.How I give it pattern? - cognos

I want to give a pattern in cognos. like this
my number : 12.20
my wanted number : 12.2 i want to delet 0 how I give pattern.

If no data format is mentioned, then the default format will take care of trailing zeros.
But if you are using some data format (number, currency) then the trailing zeros will be added till the mentioned decimal places in your format.
To suppress a digit if the value is zero, you can use pattern attribute in the Data Format property.
In your example, to suppress 2nd decimal place zero, you can mention the pattern as
.0#
With this pattern, first decimal place digit will be shown even if the value is zero. Whereas, second decimal place digit will not be shown even if the value is zero.
Please refer to IBM Cognos inforcenter for Decimal Format Symbols for the Pattern. http://publib.boulder.ibm.com/infocenter/c8bi/v8r4m0/index.jsp

Related

How to remove all decimal points, but retain value In Microsoft Excel?

I need to display with no decimal, but retaining the numbers that
appear after the last decimal. For example, given `03.1037.190
I tried roundup and trunct but not sure how it works.
Try this on a string where . could be on a dynamic spot
=SUBSTITUTE(A1,".","",LEN(A1)-LEN(SUBSTITUTE(A1,".","")))
Or when your string always follows the same pattern ##.####.####.## you could try:
=REPLACE(A1,13,1,"")
The question is quite unclear as you have a value with the same thousand and decimal delimiter and also 4 numbers between the delimiters. It would help a lot if you specified the actual number without thousand delimiters.
Assuming there are no decimals (31.037.190.301): remove "." using:
=SUBSTITUTE(A1,".","")
and Excel will recognize it as a number

Formatting of number with currency symbol

I am values in Excel with format (e.g. ₹18.05 with custom format as [$₹-ur-IN]#,##0.00. There are times when the values are displayed as ₹0.00. In the cases the value happen to be ₹0.00, I want to display blank cell. Please let me know what changes are required in custom format to achieve the same.
Thanks
The format is specified as
<Format for positive values>;<Format for negative values>;<Format for zero values>
You can just provide no format for the case where you have a zero:
[$₹-1FAE37]#,##0.00;-[$₹-1FAE37]#,##0.00;
depending how you want to handle any negative values.
Semicolon (;) may be a different character in your locale.

Show zeroes in a Regular Expression decimal

Can someone tell me how to get the zeroes to show in a regular Expression containing zeroes for decimals.
For Example 1,320.00 When I turn it to a Regular Expression the .00 disappears. I need them to show. Here is the formula I was working with.
(^\d*\.?\d*[0-9]+\d*$)|(^[0-9]+\d*\.\d*$)
Any help would be appreciated.
thanks,
Here's a pattern which will capture the full number, including commas and decimals:
^(\d{1,3},)*\d{1,3}\.\d\d$
The first group, (\d{1,3),), will match groups of one to three digits followed by a comma. It is followed by a *, so the pattern will match 0 or more of these groups (i.e. it will still match 320.00 and 12,312,122.00).
The second part, \d{1,3}\., will match the 1-3 digits preceding the decimal point.
Finally, \d\d$ match the two decimal points. It looked like you're trying to match US currency, so I hard-coded in 2 digits for readability, but if you need to match, say, one or more decimal points, try this:
^(\d{1,3},)*\d{1,3}\.\d+$
Here's a demo.

Excel – locale-independent Number Format

I looking for a number format that is locale-independent.
Let's say that I want that my Excel file use an a character as a thousand separator and a b character as a decimal separator on every computer (so this question is not about local Excel settings). The second wish is that the number has always two decimal places.
Can I do this only with a number format without VB code?
After some attempts, I came to this format: ###\a###\a##0\b.00.
1234567.89 > 1a234a567b.89
The problems are:
I must repeat ###\a section and I can not get rid of dot decimal separator (the decimal places are not taken into account without the dot character).
Can I do this only with a number format without VB code?
No.
Even if you can get your separator characters inserted, you will not be able to remove the decimal separator.
The decimal separator is displayed in the cell whenever it is included in custom number display format settings.

Extending a binary number to 32 bits in text

I have this number
111100000000000010001000
I want to extend it to 32 bits with leading zeros. In other words:
00000000111100000000000010001000
So I found this suggestion here:
Add leading zeroes/0's to existing Excel values to certain length
is to use the Right function. So I do:
=RIGHT("00000000000000000000000000000000"+A1,32)
I end up getting a number in Engineering notation. So as suggested somewhere else I add:
=TEXT(RIGHT("00000000000000000000000000000000"+A1,32), "0")
I still get
111100000000000000000000
Not 32-bit and the trailing 10001000 has become zeros.
Any idea what's happening here??
Excel takes that as a decimal number, not a binary number.
111100000000000010001000 as a decimal number is too much for the number precision Excel has to offer, so that is rounded to 111100000000000000000000 before you apply your zeros (which you can see yourself if you apply a numeric format to A1 that disallows scientific notation).
The solution is the same, treat all numbers as string. Prefix the source number in A1 with an apostrophe to make it a string, the RIGHT will then work as you expect.
Well, it actually won't, because I used + when I should have used &, so Excel will try to convert to numbers and actually make the addition. So correct the formula:
=RIGHT("00000000000000000000000000000000"&A1,32)

Resources