Creating a chart in Excel that ignores #N/A or blank cells

前端 未结 19 1614
挽巷
挽巷 2020-12-03 04:25

I am attempting to create a chart with a dynamic data series. Each series in the chart comes from an absolute range, but only a certain amount of that range may have data, a

相关标签:
19条回答
  • 2020-12-03 04:54

    I was having the same problem.

    There is a difference between a Bar chart and a Stacked Bar chart

    As there is a difference between a Line chart and a Stacked Line chart.

    The stacked one, will not ignore the 0 or blank values, but will show a cumulative value according with the other legends.

    Simply right click the graph, click Change Chart Type and pick a non-stacked chart.

    0 讨论(0)
  • 2020-12-03 04:57

    One solution is that the chart/graph doesn't show the hidden rows.

    You can test this features doing: 1)right click on row number 2)click on hide.

    For doing it automatically, this is the simple code:

    For Each r In worksheet.Range("A1:A200")
       If r.Value = "" Then 
          r.EntireRow.Hidden = True 
       Else: 
          r.EntireRow.Hidden = False
    Next
    
    0 讨论(0)
  • 2020-12-03 04:58

    I had a similar issue using an X/Y chart but then also needed to calculate the correlation function on the two sets of Data.

    =IF(A1>A2,A3,#N/A) allows the chart to be plotted but correlation of X & Y fails.

    I solved this by =IF(A1>A2,A3,FALSE)

    The FALSE can then be removed using conditional formatting or other tricks

    0 讨论(0)
  • 2020-12-03 05:03

    If you have an x and y column that you want to scatterplot, but not all of the cells in one of the columns is populated with meaningful values (i.e. some of them have #DIV/0!), then insert a new column next to the offending column and type =IFERROR(A2, #N/A), where A2 is the value in the offending column.

    This will return #N/A if there is a #DIV/0! and will return the good value otherwise. Now make your plot with your new column and Excel ignores #N/A value and will not plot them as zeroes.

    Important: do not output "#N/A" in the formula, just output #N/A.

    0 讨论(0)
  • 2020-12-03 05:03

    just wanted to put my 2cents in about this issue...

    I had a similar need where i was pulling data from another table via INDEX/MATCH, and it was difficult to distinguish between a real 0 value vs. a 0 value because of no match (for example for a column chart that shows the progress of values over the 12 months and where we are only in february but the rest of the months data is not available yet and the column chart still showed 0's everywhere for Mar to Dec)

    What i ended up doing is create a new series and plot this new series on the graph as a line chart and then i hid the line chart by choosing not to display the line in the options and i put the data labels on top, the formula for the values for this new series was something like :

    =IF(LEN([@[column1]])=0,NA(),[@[column1]])

    I used LEN as a validation because ISEMPTY/ISBLANK didn't work because the result of the INDEX/MATCH always returned something other than a blank even though i had put a "" after the IFERROR...

    On the line chart the error value NA() makes it so that the value isn't displayed ...so this worked out for me...

    I guess it's a bit difficult to follow this procedure without pictures, but i hope it paints some kind of picture to allow you to use a workaround if you have a similar case like mine

    0 讨论(0)
  • 2020-12-03 05:03

    While this is an old post, I recently came across it when I was looking for a solution to the same issue. While the above solutions do prevent charts from plotting data (when source cells are #N/A or made to look blank), it doesn't resolve the issue of the chart data labels themselves still showing a zero label.

    I had searched and searched and almost given up, when I came across the solution posted online @ https://www.extendoffice.com/documents/excel/2031-excel-hide-zero-data-labels.html

    It worked liked a charm. Attached is an image showing an example of how the data (labels) displayed before, Chart#1, and how it displays using this tip chart#2.

    enter image description here

    0 讨论(0)
提交回复
热议问题