简体   繁体   English

如何查找日期并返回一行中最低的项目

[英]How to lookup a date and return the lowest item in a row

I have two worksheets.我有两个工作表。 On Sheet1, column A is a date/time, column B is a float number, and column C is where I will put this formula.在 Sheet1 上,A 列是日期/时间,B 列是浮点数,C 列是我将放置此公式的位置。 Sheet1 (example 2 columns): 6/1/2020 3:48 1.1117 Sheet1(示例 2 列): 6/1/2020 3:48 1.1117

Sheet2 has a date/time in column A sorted ascending and float values in columns B:DA. Sheet2 在 A 列中有一个日期/时间,在 B:DA 列中按升序和浮点值排序。 Sheet2 (example 7 columns): 06/01/2020 00:24 1.1103 1.1100 1.1096 1.1103 1.1114 1.1107 Sheet2(例如 7 列): 06/01/2020 00:24 1.1103 1.1100 1.1096 1.1103 1.1114 1.1107

My formula criteria is:我的公式标准是:

  • Find the same date/time from Sheet1!A2 in Sheet2!A:A在 Sheet2!A:A 中从 Sheet1!A2 中查找相同的日期/时间
  • Find all values in that row found in criteria 1 that are greater than Sheet1!L2查找在条件 1 中找到的该行中大于 Sheet1!L2 的所有值
  • Return the lowest value found返回找到的最低值

I thought I could do: Min(Filter(Sheet2!A2:DA5,("="A2)*(">"L2),1)) .我以为我可以这样做: Min(Filter(Sheet2!A2:DA5,("="A2)*(">"L2),1)) But that did not work.但这没有用。

I appreciate any suggestions.我很感激任何建议。

Please try this formula.请试试这个公式。 It will work in Excel versions 2016 and up.它适用于 Excel 2016 及更高版本。 For earlier versions you will need an array formula using MIN and IF separately.对于早期版本,您将需要一个分别使用 MIN 和 IF 的数组公式。 Look for guidance here . 在这里寻找指导

[C2] =MINIFS(INDEX(Sheet2!$B$1:$G$8,MATCH($A2,Sheet2!$A:$A,0),0),INDEX(Sheet2!$B$1:$G$8,MATCH($A2,Sheet2!$A:$A,0),0),">"&$B2)

INDEX(Sheet2!$B$1:$G$8,MATCH($A2,Sheet2!$A:$A,0),0) specifies the row determined by the Match function. INDEX(Sheet2!$B$1:$G$8,MATCH($A2,Sheet2!$A:$A,0),0)指定由 Match 函数确定的行。 It's a sheet row.这是一个工作表行。 Therefore the data range must start in row 1. G8 is the last cell with data in my test range.因此数据范围必须从第 1 行开始。 G8 是我的测试范围内包含数据的最后一个单元格。 You would do well to define Sheet2!$B$1:$G$8 as a named range.您最好将Sheet2!$B$1:$G$8定义为命名范围。

The formula simply asks for the lowest value from that range to be returned which is larger than B2.该公式仅要求返回该范围中大于 B2 的最小值。 The MINIFS function is designed to work with different columns but you only need one. MINIFS 函数旨在处理不同的列,但您只需要一个。 That's why the range is repeated twice, once to draw the minimum from and once to contain the criteria.这就是该范围重复两次的原因,一次是从中提取最小值,一次是包含条件。

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

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