【问题标题】:Excel: Search within column and then search within the respective rowExcel:在列内搜索,然后在相应的行内搜索
【发布时间】:2018-04-05 10:42:49
【问题描述】:

我有一张桌子,我们称之为Table 1,有一个列identifierID,每个ID(即行)都有不同的日期。
在另一张表中,有一个月历,但也有一个具有 ID 的列。
我想要一个函数,它首先读取第一列以确定来自Table 1 的正确行。完成此操作后,它将检查本月是否有来自 Table 1 的任何对应日期用于此特定的 ID(即行)。
非常感谢您的帮助。

【问题讨论】:

  • 可能值得在您的查询中添加 VBA 标记,因为我认为您正在 UDF 中寻找答案

标签: excel search find worksheet-function


【解决方案1】:

为此,您可以使用index,match,match 方式。

如果你还没用过,我会很快解释。

index 函数的工作原理如下:

=index(A1:E10, 2, 5)
'Returns the value in the second row and the fifth column of the range "A1:E10" so the value of "E2"

match 函数的工作原理如下:

=match("Hello",A1:E1, 0)
'returns the index at which it found the value "Hello" e.g C1 has the value "Hello" it will return 3. The third paramter "0" says you want an EXACT match

假设您的表格在A1:D10 范围内,第一行是标题,第一列是 IDS。

ID    |    Value1    |    Value2    |    Value 3 
1     |     ....
2     |     ....
..

现在你想在"Value1" with ID = 3找到条目

=index(A1:D10, match("Value1",B1:D1, 0), match(3, A1:A10, 0))

【讨论】:

  • 谢谢!这很有帮助。如果我理解正确,这将搜索正确的列,然后搜索行。有没有办法扭转这种情况?先确定合适的行,再确定列。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-06-12
  • 2023-03-26
  • 2016-05-02
  • 2011-06-01
  • 1970-01-01
相关资源
最近更新 更多