Formatting a column in Excel as % without multiplying with 100 along with rounding off the value - formatting

Is it possible to come up with a format which does following
Round off the value.
Show % symbol without multiplying the number with 100
If the value is negative show the number in red color with brackets along with % sign.
Ex: If the value is:
-5.34 should be converted as (5%) in red color
-4.78 should be converted as (5%) in red color
6.33 should be converted as 6 in regular color
Currently I am using 0.00##\%;[Red](0.00##\%) format which shows % symbol wihtout multiplying value with 100 & show negative number in red color with brackets around the value but it does NOT round off the values.
Thank you

Following format is doing the trick for me : ##0\%;[Red](##0\%)

Related

How to move sign separate trailing to normal decimal field in COBOL

I have a field like
03 ws-var1 Pic s9(11)v9(2) sign trailing separate.
In the op file the value gets displayed as 00000002999200+
But I want it to be displayed as 29992.00. What definition has to be made in COBOL to so tht I get this desired result.
PICTURE
Result
Length
Notes
+9(11).9(2)
+00000029992.00
15
The sign + or - will be shown
-9(11).9(2)
00000029992.00
15
The - will show only if the value is negative
+(11)9.9(2)
+29992.00
15
The sign + or - will be shown
-(11)9.9(2)
29992.00
15
The - will show only if the value is negative
Z(10)9.9(2)
29992.00
14
The sign is removed.
In each case spaces will be present before each result if the number of characters shown is less the the length of the field.

CR | Copy data to another row using a formula field or variable

Here is my problem:
Raw data 1
If there is a position 105 and 150, I need the material number of position 150. If there is only position 105, I need the material number of position 105.
On the right side of the picture you can see the correct selected material number.
Now I need to assign this data to position 100 (bc I will use a counter later on, which is depending on position 100).
Here you can see more of the raw data of the report (I can´t insert the complete report here, I use the details area only for testing).
I marked one "group" in which you can see why I can´t change the order of the positions. In this case I need to use position 105 to output the material number (number rightmost on the red border) because there is no position 150.
Raw data 2
Here is another example with position 150 used for the material number (the correct material number will be placed on position 105 every time):
Raw data 3
To use this material number in my following tables, it need to be assigned to position 100.
Thanks!

48bit RGB single pixel value

3 RGB values are represented with a single one value in some image processing applications.
For example: The single value for RGB(2758, 5541, 4055) is 4542.64
There are some questions related on how to obtain single pixel values from 8bit RGB images but none works with 48bit RGB images. How can I obtain that value?
If I do (2758 + 5541 + 4055) / 3 the result is 4118 which is near but not the same.
It appears that you are trying to determine the grayscale formula used to arrive at that given value. I suggest that you read Seven grayscale conversion algorithms by Tanner Helland.
Based on your example of:
The single value for RGB(2758, 5541, 4055) is 4542.64
It appears that value is computed using the formula:
Gray = (Red * 0.3 + Green * 0.59 + Blue * 0.11)

SQL Server 2016 format #,### not displaying 0 value

I am calling
FORMAT(myNum, '#,###') AS myNum
Which works for 123456789 as the output is 123,456,789
Also works for negative numbers
However, 0 is showing up as a blank field.
How do I get 0 to show up as 0? I am also curious as to why 0 is being removed as the query without the format shows 0 in that column's field when there should be a 0.
Note: I do not need any decimals and would prefer to use the above code if at all possible.
If you want to display the 0, if it is zero, you should use:
FORMAT(myNum, '#,###0') AS myNum
According to this Reference:
https://msdn.microsoft.com/en-us/library/ee634206.aspx
0 (zero character)
Digit placeholder. Displays a digit or a zero. If the expression has a digit in the position where the zero appears in the format string, displays the digit; otherwise, displays a zero in that position.
If the number has fewer digits than there are zeros (on either side of the decimal) in the format expression, displays leading or trailing zeros. If the number has more digits to the right of the decimal separator than there are zeros to the right of the decimal separator in the format expression, rounds the number to as many decimal places as there are zeros. If the number has more digits to the left of the decimal separator than there are zeros to the left of the decimal separator in the format expression, displays the extra digits without modification.
# Digit placeholder:
Displays a digit or nothing. If the expression has a digit in the position where the # character appears in the format string, displays the digit; otherwise, displays nothing in that position.
This symbol works like the 0 digit placeholder, except that leading and trailing zeros aren't displayed if the number has fewer digits than there are # characters on either side of the decimal separator in the format expression.

vb.net what is a good way of displaying a decimal with a given maximum length

I am writing a custom totaling method for a grid view. I am totaling fairly large numbers so I'd like to use a decimal to get the total. The problem is I need to control the maximum length of the total number. To solve this problem I started using float but it doesn't seem to support large enough numbers, I get this in the totals column(1.551538E+07). So is there some formating string I can use in .ToString() to guarentee that I never get more then X characters in the total field? Keep in mind I'm totaling integers and decimals.
If you're fine with all numbers displaying in scientific notation, you could go with "E[numberOfDecimalPlaces]" as your format string.
For example, if you want to cap your strings at, say, 12 characters, then, accounting for the one character for the decimal point and five characters needed to display the exponential part, you could do:
Function FormatDecimal(ByVal value As Decimal) As String
If value >= 0D Then
Return value.ToString("E5")
Else
' negative sign eats up another character '
Return value.ToString("E4")
End If
End Function
Here's a simple demo of this function:
Dim d(5) As Decimal
d(0) = 1.203D
d(1) = 0D
d(2) = 1231234789.432412341239873D
d(3) = 33.3218403820498320498320498234D
d(4) = -0.314453908342094D
d(5) = 000032131231285432940D
For Each value As Decimal in d
Console.WriteLine(FormatDecimal(value))
Next
Output:
1.20300E+000
0.00000E+000
1.23123E+009
3.33218E+001
-3.1445E-001
3.21312E+016
You could use Decimal.Round, but I don't understand the exact question, it sounds like you're saying that if the total adds up to 12345.67, you might only want to show 4 digits and would then show 2345 or do you just mean that you want to remove the decimals?