Home » Questions » Computers [ Ask a new question ]

Custom format positive and negative in Excel

Custom format positive and negative in Excel

I have a number format in Excel that rounds the display of numbers like 3,105,245 to $3.1M and 34,235 to $34K.

Asked by: Guest | Views: 286
Total answers/comments: 2
Guest [Entry]

"I've been reading around and from what I can tell, what you ask is impossible. Conditional formatting is limited to two conditional statements (source,source).

That doesn't mean you can't have this display the way you want, but will take a more complicated route, which requires that you put the following in another column.

=CONCATENATE(IF(A1<0,""-$"",""$""),IF(ABS(A1)>=1000000,FIXED(ABS(A1)/1000000,1),IF(ABS(A1)>=1000,ABS(A1)/1000,ABS(A1))),IF(ABS(A1)>=1000000,""M"",IF(ABS(A1)>=1000,""K"","""")))

More visually pleasing version (this is all strung together in a single cell, no carrige returns)

=CONCATENATE(IF(A1<0,""-$"",""$""),
IF(ABS(A1)>=1000000,FIXED(ABS(A1)/1000000,1),
IF(ABS(A1)>=1000,ABS(A1)/1000,ABS(A1))),
IF(ABS(A1)>=1000000,""M"",IF(ABS(A1)>=1000,""K"","""")))

This blob of a formula does what it seems you want your conditional format to do. It assumes that the value you want to ""format"" is in cell A1. You can adjust the reference as needed to fit your spreadsheet.

I realize that this method is not solving the problem in the way you want. It also may not be usable depending on the reasons why your can't use conditional formatting. Without knowing the full details, I really can't know if this will work for you or not. If you are worried about duplicate data being viewed, you can always hide a column.

[EDIT]

Charts are different because you have to use macros to get it to do the really wild stuff. I ran across this page with some useful information on how to set stuff up. Looking over the ""Arbitrary Axis Scale"" page, it mentions that a third party has a free excel add-on that might do the trick. I haven't tested it, but it seems like it should allow you to change your axis scales to show the correct value, assuming you are using a line graph.

If you are using a bar, pie, or specialized graph. You'll probably have to turn the graph into a picture and then add the custom labels as needed. Not a path I would go down, but may be your only option.

[EDIT]

I hope this helps."
Guest [Entry]

"From your description you seem to be limited by the number of conditional formats rather than not being able to use them at all (unless I misunderstdood)

You could use two custom formats like the one you have but for the positive and negative numbers separately, and a conditional format to switch to the negative version for negatives, so in one condition you are switching between your 6 formats for millions, thousands, small numbers, in positive and negative forms."