Number formatting help in Excel - excel

I'm using a custom number format and conditional formatting in cells so that the displayed value is different than the actual value. The custom number format is [<=500]$#,",000" and changes a number like $125,600 to $126,000 (i.e. it rounds it to the nearest thousand). However, with negative numbers, it leaves the "-" in front of the number. I'd like to address it so that it changes it to parenthesis instead of the negative sign, but with the customer format I'm using, I haven't had success incorporating it. I tried different versions on my own and none of them help.

This should be what you're after
[>=500]$#,",000";[<=-500]($#,",000")
The formatting after the semi-colon applies to negative numbers, by using a different condition <=-500. The first condition, >=500, will only be appropriate for positive numbers.
If you want to wrap your negative numbers in square brackets rather than parentheses, you need to escape the brackets like this
[>=500]$#,",000";[<=-500]\[$#,",000"\]

Related

Changing the format of the value inserted in excel or making it more readable

Is there any formula in excel by which we can change the format in a way to make it easier to read
Example :
Existing: 17752528.25
Expected: 17,752,528.25
Along with the above thing, if any value inserted in the any cell of excel then that value can be entered with leading zeros without the need to change the cell format
Example :
should allow to insert the value in a cell as : 00098756 i.e with the leading zeros and even after switching the cell or saving the sheet, the value remain as it is.
Or do i need to write a custom program using VBA for both the scenario.
Thank you !
You have to carefully think about your data and data types on the one hand and it's representation on the other.
Your first example looks like a real number for me, 17 millon 752 thousand... If it is, you could use it in any calculation. Displaying it with thousand separator is a matter of formatting. The value of this number doesn't change, no matter how you format it, the format only defines how it is represented to the user. No matter if you display it as 17752528,25, 17,752,528.25, 1,78E+07, the value stays the same. And on my computer, it would be displayed as 17.752.528,25 as my computer is configured to have a comma as decimal separator - but still, the value would be the same.
If I am wrong and it is a string, you need some coding to get the commas in it, but that would change the string, so it's no longer a matter of formatting. The value without and the value with the commas would be total different.
Now, if it comes to input where leading zeroes matter, you have clearly not a number but a string. If the user enters 00098756 and it would be a number, the value would be 98756. You can change the representation to display leading zeroes, but you will not know how many leading zeroes the user entered.
To keep the zeroes exactly as the user entered, you need either to format the cell as text or the user has to enter a leading ', else Excel will interpret the input as number and immediately throw away the zeroes. Now, you have a string that contain only digits, but keep in mind that 00098756 is not equal to 98756 or 98,756. You can, however, use the value-function in Excel (or val in VBA) to get it's numerical value.

Excel Custom Formatting and/or Formula

I have a list of numbers for a client like below:
8481.80.9005
8481.80.9005
8413309090
8413309090
The first two numbers exhibit the correct formatting, per the client. Is there a formula and/or custom formatting that I can use to make all numbers uniformly the correct format?
Note - all numbers are 10 digits with periods after the fourth and sixth digits.
I know I'm going to be shot down on this one, but couldn't see why you can't do
0000\.00\.0000
in custom formatting
The problem with a custom format is that Excel will read the number as a whole number and any attempt at putting in the ., if your local settings are set to the . being the decimal separator, is that it will try to put it at the end.
So we need to first make it a string with some other separator and then do a substitute.
The following formula does that:
=SUBSTITUTE(TEXT(A1,"0000-00-0000"),"-",".")

Excel: Omit minus sign when formatting cell

First of all, I realize that there are threads like this already, but I cannot get the examples I've seen to work. What I want to accomplish is that a cell value should be presented as "x,xx" and in red color if the value is higher than 0, and otherwise in Color 14.
For instance, if this formatting would be used on
0,05-0,03
It would return (in red):
0,02
What I have done is to format the cell as:
[Red][>0]0,##;[Color14][<=0]0,##;
but it prints out a minus sign for values less than or equal to 0, which I do not want. Changing to:
[Red][>0]0,##;[Color14][<=0]0.##;
Omits the minus sign, as I want, but it makes the cell red which is not intended.
I've also tried a numerous combinations of ",", "." and "#" but it just wont work as intended.
I hope anyone can shed some light into this.
EDIT Using "General" instead of "0,##" prints out many more decimals than desired.
EDIT2 I use a Swedish Excel and hence I translate the formulas to Swedish formulae. Perhaps of importance?
See: https://support.office.com/en-us/article/Create-or-delete-a-custom-number-format-78f2a361-936b-4c03-8772-09fab54be7f4
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.
<POSITIVE>;<NEGATIVE>;<ZERO>;<TEXT>
So for your requirement no [conditions] are needed.
[Red]0,##;[Color14]0,##;[Color14]0,##
will suffice.
As for your further descriptions
[Red]0,00;[Color14]0,00;[Color14]0,00
may be better.
You cannot change the value of the cell with formatting, only the appearance.
So if you want the cell value to actually be positive it is not possible to do this way.
If this is what you actually want to do, try =ABS(A1) (will have to be done in another cell)

How to add cells with mix of 6 to 8 decimal places together

Because of floating point values, I cannot add a string of cells that contain values such as:
0.08178502
0.09262585
0.13261762
0.13016377
0.12302067
0.1136332
0.12176183
0.11430552
0.09971409
0.125285
Even if I try adding the first two through a sum formula or auto sum through selecting them, excel spits out an error. I have googled this like crazy and tried to change number formats. Is there a function that can allow me to add this information ?
Screenshot:
The spreadsheet is available on my Dropbox.
Those numbers are all preceded by a NBSP (Char Code 160). So, in order to sum them, you have to remove that. Many solutions. Here's one:
=SUMPRODUCT(--SUBSTITUTE(A1:A18,CHAR(160),""))
If a formula like:
=A1+A2+A3+A4+A5+A6+A7+A8+A9+A10
produces:
#VALUE!
then your "numbers" cells contain non-visible characters.
They must be removed before the formula will work.
If the cells contain text strings and not actual values you will need to convert the text to numeric values before performing any calculations. The function "=value(cell)" will bring the numeric value.
e.g.: A1 contains "000.12345678" (or some other non-numeric presentation of numerals)
In cell B1 type: =value(a1)
Cell B1 now operates as the real number 0.12345678
Oddly enough, the fact that it said 0.xxxxx in all numbers vs. .xxxxx is what the issue was. I'm just sharing that for folks who google/search and have same issue.
All I had to do was select that whole row and do a search in replace for "0." and make it just "." and now my numbers were usable in equations. For some reason the adjustment of formating as many searches suggested wasn't working

Does this variation on "return last numeric value in column" formula have any known fail conditions that anyone can see?

The parameters are:
The column may contain either negative or positive numbers (including the decimals forms of proper fractions), blank cells, text or errors (like #DIV/0!), and will have data added to it over time.
It uses LOOKUP in its vector form.
The formula (with Column A as the column in question) is:
=LOOKUP(1,-1/A:A^2,A:A)
The thinking is
First make sure any negative numbers are positive by squaring them using A:A^2
Make all the numbers negative by using -1/<resulting number from 1.>.
Then, when LOOKUP goes looking for the value 1, it will exploit the behaviour of LOOKUP to return the last number in column for a value that it can't find that is greater than any of the numbers in the resulting array.
I think it works in all circumstances, but can anyone see something that breaks it?
Thanks in advance.
It won't work if the last number is zero, that will generate a #DIV/0! error which LOOKUP will ignore
Why not
=LOOKUP(9.99999999999999E+307,A:A)

Resources