• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Custom format

madocar

Member
Hi everyone,

how can I modify my custom number format to show negative number as well. Is it even possible to show these custom format numbers below zero

[>=1000000]#,#0 " M";[>=1000]0 " K";0

Thanks
 
See attached file for an example with Conditional Formating
 

Attachments

  • Sample Number formating.xlsx
    9.6 KB · Views: 2
Hi, madocar!

New avatar I guess... hope it's a picture of you... or at least you got the phone number ;)

Formatting conditions are originally defined for 4 case:
Positive; Negative; Zero; Text
However the conditions proved to be somehow flexible but somehow rigid as well. Flexible since you could use them for number ranges instead of the standard categories but rigid since you can only have 4.

About your question I'm not sure if you want to get the numbers displayed as in Xiq's file:
111.207.628 M
115.259 K
628
-653
-9.280 K
-115.259.280 M
...or as:
111 M
115 K
628
-653
-9 K
-115 M

However you want, you can't do it directly from cell custom format, as you require 6 or 7 conditions.

Now, if you're after the 1st examples go with Xiq's solution, but if you're after then 2nd ones, you'll have to use a helper column as follows:
=A1/10^(ENTERO(LOG(ABS(A1))/3)*3) -----> in english: =A1/10^(INT(LOG(ABS(A1))/3)*3)
and apply a CF to it depending on original A1 values (as in Xiq uploaded file).

Maybe this helps too.
http://chandoo.org/forum/threads/cell-format-negative-numbers.12766/#post-75103

Regards!
 
Hi guys,

thank u so much for your advices.
I finally managed it .... almost. I use this format

[>=1000000]#,#0 " M";[>=1000]0 " K";0 " K"

It shows numbers almost exactly as I wanted. Except "Zero" value shows like 0 K, which doesn't make any sence.
It would be better to show Zero value like "0" with no letter. This I could not manage. Excel file in attachment
 

Attachments

  • chandoo_custom number_format.xlsx
    18.3 KB · Views: 4
Hi, madocar!

Have you checked the uploaded file? I don't happen to see any cell formatted as described.

Despite of this try, you're only using 3 conditions (of the 4 available), and according to them your negative values should be displayed unsigned and with the " K" suffix independently of their value, am I wrong?
1st condition: >= 1000000
2nd condition: >= 1000
3rd condition: implicitly for <1000 (which include zero and all negative numbers)

Regards!
 
Hi, Madocar!
Then glad you solved it, I should have misread you. Thanks for your feedback and welcome back whenever needed or wanted.
Regards!
 
Back
Top