根据多个条件和日期范围报告文本字段的公式

时间:2017-09-18 15:32:18

标签: excel date indexing excel-formula excel-2010

我正在尝试创建一个搜索单独工作表的公式,并使用文本字符串报告正确的单元格。条件(如果过滤工作表)包含日期范围,hive> select * from employee_raw; OK {"employee":{"firstName":"Ganesh","lastName":"Kumar","address":{"street":"1400 Dakota Dr","city":"Princeton","state":"NJ","zip":"09800"}}} {"employee":{"firstName":"Ganesh","lastName":"Kumar","address":{"street":"1400 Dakota Dr","city":"Princeton","state":"NJ","zip":"09800"}}} {"employee":{"firstName":"Ganesh","lastName":"Kumar","address":{"street":"1400 Dakota Dr","city":"Princeton","state":"NJ","zip":"09800"}}} {"employee":{"firstName":"Ganesh","lastName":"Kumar","address":{"street":"1400 Dakota Dr","city":"Princeton","state":"NJ","zip":"09800"}}} {"employee":{"firstName":"Ganesh","lastName":"Kumar","address":{"street":"1400 Dakota Dr","city":"Princeton","state":"NJ","zip":"09800"}}} Time taken: 0.123 seconds, Fetched: 5 row(s) 基本上是从月末开始超过30天的任何日期范围,其中日期由用户在单元格U $ 1中设置并匹配文本字符串。我已尝试过几次INDEX MATCH迭代,在数组中使用MATCH但仍然出现#N / A错误。

逻辑是返回G列中相应单元格的内容,如果日期早于月末前30天(F列中的日期),则按最旧到最新排序,列P必须包含文本字符串“文件未验证”

<=DATE(YEAR(U$1),MONTH(U$1)+1,DAY(U$1))-31

此公式返回与条件匹配的正确条目数,但是,我无法插入索引匹配以显示最旧的条目

1 个答案:

答案 0 :(得分:1)

使用INDEX / AGGREGATE作为标准公式; AGGREGATE提供没有CSE的阵列处理,就像SUMPRODUCT一样。出于这个原因,请避免使用完整的列引用。

=iferror(index('Summary'!G:G,
  aggregate(15, 6, row(Summary!P$1:index(Summary!P:P, match("zzz", Summary!P:P)))/
 ((Summary!P$1:index(Summary!P:P, match("zzz", Summary!P:P))="file not validated")*
  (Summary!f$1:index(Summary!f:f, match("zzz", Summary!P:P))<=DATE(YEAR(U$1),MONTH(U$1)+1,DAY(U$1))-31))), 1)), "")

您在叙述中表示您的月末工作正常,但看起来不应该如此。我在评论中提供了几个更好的计算月末计算公式。你可能想看一下。