[英]Excel MAX/MIN but only if opposing cell is greater than 0
I've found similar examples through searching but I can't find anything that matches the issue that I have...我通过搜索找到了类似的例子,但我找不到任何与我遇到的问题相匹配的东西......
I have a table which shows parts received/rejected, I wish to see the maximum days early/late (I'll only need help with one as the other I can then do.) - but there are dummy orders which I wish to ignore (they show a received/reject of 0).我有一张表格,显示收到/拒绝的零件,我希望看到最早/延迟的最大天数(我只需要一个帮助,因为我可以做另一个。) - 但是有一些我希望忽略的虚拟订单(它们显示接收/拒绝为 0)。
Here is example data from the 'AnnualDump' sheet:以下是“AnnualDump”表中的示例数据:
My current calculation is我目前的计算是
=IF(ISBLANK(AnnualDump!$H$2),"BLANK",0-MIN(AnnualDump!$G:$G))
[Column H is Received/Rejected and G is VarianceDays] [H 列是 Received/Rejected,G 是 VarianceDays]
This simply looks at if there is any data on the sheet before running the calculation, which is fantastic for 95% of the time... but I want to ignore any values that have a received/rejected of 0...这只是在运行计算之前查看工作表上是否有任何数据,这在 95% 的时间里都很棒......但我想忽略任何接收/拒绝为 0 的值......
I want it to show 29, but it's showing 30 in this instance as it's not ignoring 0qty lines.我希望它显示 29,但在这种情况下它显示 30,因为它没有忽略 0qty 行。 I've tried adding another IF statement but it didn't work:/
我尝试添加另一个 IF 语句,但它不起作用:/
Completely stuck now and not sure what the next step to try is... I can do it if I cheat (call both columns to another sheet, turn text white, use an 'IF cell greater than x, then value' to compare the whole lot and then min/max that third column) but I'm trying to avoid that!现在完全卡住了,不确定下一步要尝试什么...如果我作弊,我可以做到(将两列都调用到另一张表,将文本变为白色,使用“如果单元格大于 x,则值”来比较很多,然后是第三列的最小值/最大值),但我试图避免这种情况!
Any pointers or help will be greatly appreciated (complete VBA noob in excel so I'd like to avoid that if possible).任何指针或帮助将不胜感激(在 excel 中完成 VBA noob 所以我想尽可能避免这种情况)。
Thanks谢谢
Try this array formula.试试这个数组公式。 Confirm with Ctrl, Shift and Enter and curly brackets will appear round the formula.
使用 Ctrl、Shift 和 Enter 确认,大括号将出现在公式周围。
I would strongly suggest you don't use full column references though as these formulae are rather resource-intensive.我强烈建议您不要使用完整的列引用,因为这些公式相当耗费资源。
=IF(ISBLANK(AnnualDump!$H$2),"BLANK",0-MIN(IF(AnnualDump!$H:$H>0,AnnualDump!$G:$G)))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.