简体   繁体   English

Excel-动态图表x轴-忽略没有数据的x类别

[英]Excel - dynamic chart x axis - ignore x categories with no data

I have a predefined list of x labels, eg months of the year. 我有一个x标签的预定义列表,例如一年中的月份。 I want to dynamically exclude some of these from my excel plot, eg if some of the y values are blank, zero or errors. 我想从我的excel图表中动态排除其中一些,例如,如果某些y值为空白,零或错误。

Things I've tried: 我尝试过的事情:

  • If I use an (if data is bad, then change xlabel to blank or NA()) process, excel still leaves a space for the blank or #N/A x label - see image. 如果我使用(如果数据不好,则将xlabel更改为blank或NA())过程,excel仍会为空白或#N / A x label留一个空间-参见图像。 This is the second most upvoted answer to Creating a chart in Excel that ignores #N/A or blank cells , but doesn't quite do what I'm after... Unfortunately, there is no option for 'No Gaps' in the Hidden and Empty Cell Settings. 这是在Excel中创建图表的第二个最受好评的答案, 该图表将忽略 #N / A或空白单元格 ,但并不能完全满足我的要求...不幸的是,在隐藏和空单元格设置。

如果Y值有问题(空白,非数字等),我想从图表中动态排除相应的序列

  • If I filter out rows where the Y values meet the reject condition, I get the chart I want, but the filter doesn't update automatically when the Y values get changed by a calculation elsewhere, ie its not dynamic. 如果我过滤掉Y值满足拒绝条件的行,则会得到所需的图表,但是当Y值因其他地方的计算而改变时(即它不是动态的),则过滤器不会自动更新。 Pivot charts are the same. 数据透视图相同。
  • I can't get formulaic named ranges ( Excel charts - setting series end dynamically ) to do what I want - the formula will return something like 'Jan, FALSE, Mar, Apr' rather than 'Jan, Mar, Apr', and we end up with the same problem as in the picture above. 我无法获得公式化的命名范围( Excel图表-设置系列动态结束 )来执行我想要的操作-公式将返回“ Jan,FALSE,Mar,Apr”之类的内容,而不是“ Jan,Mar,Apr”,而我们最终遇到与上图相同的问题。

Non-VBA solutions preferred = ) 首选非VBA解决方案=)

Buddy, seems Non-VBA solution is still to be found, as solution lies on hiding the said row. 伙计,似乎仍然可以找到Non-VBA解决方案,因为解决方案在于隐藏所述行。 However if you are bent on finding non-vba solution then here is very crude solution - suppose this is the data (C3:I15) with the helper columns which has been described below - 但是,如果您一心一意地寻找非vba解决方案,那么这里的解决方案非常简单-假设这是带有帮助器列的数据(C3:I15),如下所述-

在此处输入图片说明

  • helper column (hC1) has formula 助手列(hC1)具有公式

    =IF(ISNUMBER(D4),1,"") = IF(ISNUMBER(D4),1, “”)

  • hC2 has formula hC2具有公式

    =IFERROR(E4*ROW(),"") = IFERROR(E4 * ROW(), “”)

  • hC3 has formula hC3具有公式

    =SMALL($F$4:$F$15,ROW()-3) =小($ F $ 4:$ F $ 15,ROW() - 3)

    • X has formula X有公式

    =IF(ISNUMBER(G4),INDEX(C4:C15,MATCH(G4,F4:F15,0)),"") = IF(ISNUMBER(G4),INDEX(C4:C15,MATCH(G4,F4:F15,0)), “”)

    • Y has formula Y有公式

    =VLOOKUP(H4,C4:D15,2,FALSE) = VLOOKUP(H4,C4:D15,2,FALSE)

drag down all the formulas after entering into first rows.... 进入第一行后,向下拖动所有公式。

Now you can plot chart from continuous data - 现在您可以根据连续数据绘制图表-

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM