+ Reply to Thread
Results 1 to 8 of 8

Axis Formatting Negative Numbers

  1. #1
    Registered User
    Join Date
    01-18-2012
    Location
    Los Angeles USA
    MS-Off Ver
    Excel Office 365
    Posts
    80

    Axis Formatting Negative Numbers

    I am using the following format code for the y axis of a line chart. I am shortening the axis to show 3M or 500K instead of $3,000,000 or $500,000. I can't get it to work with negative numbers, I get the full $3,000,000. Somewhere I read you can only do 3 formats in a formula. Is there a way to include negative numbers using this formatting?

    [>999999]$#,,”M”;[>999]$#,”K”;$#

    Thanks

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,835

    Re: Axis Formatting Negative Numbers

    Do you need a fourth section? If you don't need to worry about numbers between 1e5 and -1e5, there are only 3 regions to worry about: [>=1e6]0,,\M;[>-1e6]0,\k;0,,\M See if that will work.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    01-18-2012
    Location
    Los Angeles USA
    MS-Off Ver
    Excel Office 365
    Posts
    80

    Re: Axis Formatting Negative Numbers

    That seems to have done the trick, thanks much.
    1. How would I add [Red] to the negative numbers?
    2. Is the \M the same as "M"?
    3. What does your code do different than what I had?
    4. Is there a way to permanently save the code for use with other workbooks?
    5. How do i delete
    useless code that I created while trying to get this going? Don't see delete function as in normal formatting.

    Thanks again

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,835

    Re: Axis Formatting Negative Numbers

    Help file with an explanation of available custom number format codes: http://office.microsoft.com/en-us/ex...503.aspx?CTT=1

    1-3: Adding a color to any section should be as easy as adding the color specification to the desired section. However, you should note that, in order to make +500K appear black and -500K appear red will add a fourth section to the number format code, which we have already established will not work. For formatting axis labels, you may have to choose between having negative numbers appear red and having numbers between -1E6 and +1E6 appear with the K instead of M. Or explore something much more complex (like John Peltier's "arbitrary axis technique" with code to set the formatting and coloring of the axis/data labels.

    The main thing that I saw differently is that I assumed, from your original post, that you wanted to format everything between -1E6 and +1E6 the same (0,\K). Adding the color means that this observation is no longer true.

    As noted in the "display both text and numbers" paragraph, the backslash \ can be used to precede a single character that you want displayed. It is the same as using quotation marks around the text you want displayed.

    4-5: I really don't know. Back in 2002, I got used to simply entering format codes in the custom box, and never bothered with storing/deleting specific codes. I have not yet bothered understanding how 2007 does this differently, so I cannot help you here.

  5. #5
    Registered User
    Join Date
    01-18-2012
    Location
    Los Angeles USA
    MS-Off Ver
    Excel Office 365
    Posts
    80

    Re: Axis Formatting Negative Numbers

    Thanks MrShorty, the code you provided worked great for me just wanted to better understand my options.
    Al

  6. #6
    Registered User
    Join Date
    01-18-2012
    Location
    Los Angeles USA
    MS-Off Ver
    Excel Office 365
    Posts
    80

    Re: Axis Formatting Negative Numbers

    Do you have an updated Microsoft link, the link you shared is dead, thanks.

  7. #7
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,835

    Re: Axis Formatting Negative Numbers

    It seems to work for me.

    FWIW, the help file I linked to is the same help file that should have been installed with your office installation. You should be able to find that same help file by putting "custom number format codes" or other suitable search string into the help box (the question mark in upper right of the ribbon in Excel).

  8. #8
    Registered User
    Join Date
    01-18-2012
    Location
    Los Angeles USA
    MS-Off Ver
    Excel Office 365
    Posts
    80

    Re: Axis Formatting Negative Numbers

    Okay thanks got it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel 2007 : Formatting negative numbers
    By littlemy111 in forum Excel General
    Replies: 5
    Last Post: 11-11-2011, 04:48 AM
  2. Replies: 1
    Last Post: 10-07-2009, 08:11 PM
  3. Negative Numbers on my X axis...how to??
    By racinjason1978 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 04-30-2008, 10:31 AM
  4. [SOLVED] How do I plot negative bars/numbers BELOW the main axis in Excel
    By Maciel in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-09-2006, 09:35 PM
  5. [SOLVED] Negative numbers on X axis
    By Dee in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 03-28-2005, 09:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1