+ Reply to Thread
Results 1 to 6 of 6

Make Excel charts treat certain values as =na()

  1. #1
    Forum Contributor
    Join Date
    11-13-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    279

    Make Excel charts treat certain values as =na()

    I have attached a file with my explanation.

    An external data input always prints as #n/a n/a.

    Unfortunately Excel charts always treat this as a zero value in a line chart which is extremely frustrating.

    I am aware that I can use an if function in adjacent columns to convert this like so: =IF(C14="#n/a n/a",NA(),C14)

    However this is ugly.

    Is there a way to tell Excel instead to treat #n/a n/a as if it was =na() so the chart doesnt print any value for these cells?

    Chart attached to clarify further.

    Thank you so much,Book1.xlsx

  2. #2
    Registered User
    Join Date
    06-05-2015
    Location
    Manchester, UK
    MS-Off Ver
    2016
    Posts
    94

    Re: Make Excel charts treat certain values as =na()

    If you're just bothered about the appearance then you could potentially use custom formatting to make the N/A() text the same colour as the cell background colour, so it would be invisible.

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

    Re: Make Excel charts treat certain values as =na()

    This may be a useful read: http://peltiertech.com/mind-the-gap-...g-empty-cells/

    Off the top of my head, I see three approaches to this:

    1) By far the easiest is to use a formula to convert the "n/a" text strings into the error value N/A. However, you call this option "ugly" and don't want to use it. Since I think this is by far the easiest, I would ask why you think this is ugly. It might be easier to come up with a way around the "ugliness" (such as hiding the error values as seasider89 suggests or hiding the helper column or something like that) than to come up with another approach.

    2) Delete/Clear the cells containing the "n/a" text strings. This is not necessarily difficult, especially if the "n/a" text strings are all grouped at the top of the data set as in your example. This will need to be done every time the data is imported, which can make it tedious. It can be automated in a macro, if needed.

    3) Use some kind of "dynamic named range" that will identify the range of "n/a" text strings and exclude that from the series definition. This only works if the "n/a" text strings are all grouped at the beginning (or end) of the data as in your example. This will not work well if the text strings are scatter throughout the data set. If you are not familiar with dynamic named ranges, I would suggest starting here: http://www.excel-easy.com/examples/d...med-range.html

    How would you like to proceed?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Forum Contributor
    Join Date
    11-13-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    279

    Re: Make Excel charts treat certain values as =na()

    Seasider my issuer refers to the charts not the appearance of the numbers.

    Shorty thank you very much. I refer to it as ugly as it means I essentially double the number of cells which slows down the file. If it is the only option I will make do however. Thank-you very much,

    David

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

    Re: Make Excel charts treat certain values as =na()

    Testing by expanding your spreadsheet to 30000 data points (the limit in my version of Excel), I can see no difference in calculation time between the one column version and the two column version. If this simple helper column is slowing down your real worksheet, you might consider looking at other sources and bottlenecks for the slowdown. It does not seem to me that a simple =IF() function like this should dramatically slow down a spreadsheet.

    With the three options given, I certainly do not see this as the only option. It seems to me to be the easiest to implement. If calculation efficiency is really a concern, option 2 might be the best of the three, since it completely eliminates any need to perform additional calculations. Option 3 may not be a good option because dynamic named ranges usually introduce a volatile function (such as offset and indirect) to the spreadsheet, which may also slow down calculation.

    A fourth option just occurred to me: filtering. https://support.office.com/en-us/art...6-38c37dcc180e
    Using filtering, you can "filter out" the "n/a" text string entries, and the chart should ignore those hidden rows.

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Make Excel charts treat certain values as =na()

    You could use this named range formula to generate the chart

    MYDATA: =IF(ISNUMBER(Sheet1!$B$2:$B$14),Sheet1!$B$2:$B$14,NA())

    And the revised series formula, using named range, would be

    =SERIES(Sheet1!$B$1,Sheet1!$A$2:$A$14,'Book1(1).xlsx'!MYDATA,1)
    Cheers
    Andy
    www.andypope.info

+ 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. how to make forumla that treat blank cells as a zero?
    By Bingsmart in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 02-06-2017, 11:58 AM
  2. [SOLVED] How lines in combination charts treat #N/A values
    By Bernard Harris in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 02-16-2006, 12:20 AM
  3. How can I make a Chart data series treat blanks as "Empty" cells
    By XLADLK in forum Excel Charting & Pivots
    Replies: 10
    Last Post: 01-11-2006, 12:25 AM
  4. [SOLVED] How to make excel to treat values in cell as a number?
    By Peri in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-06-2005, 06:45 PM
  5. Excel - treat pairs of figures differently according to values
    By Alistair in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-10-2005, 06: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