简体   繁体   English

索引并匹配以返回文本值

[英]Index & Match to return text value

Having error in my formula. 我的公式中有错误。

How do i get it to display matched text output in column referencing on a column? 如何获取在列引用中的列中显示匹配的文本输出?

F11 to display A1 looking up output produce by formulas in rows above it that is not special character "-". F11显示A1查找输出,其上方的行由公式产生,不是特殊字符“-”。

G11 to display B1 looking up output produce by formulas in rows above it that is not special character "-". G11显示B1查找输出,该输出由位于其上方的行中的公式产生,该公式不是特殊字符“-”。

H11 to display B6 looking up output produce by formulas in rows above it that is not special character "-". H11显示B6查找输出,该输出由在其上方的行中的公式产生,该公式不是特殊字符“-”。

As shown in the picture below, formula below is my current input to reference column which produces error. 如下图所示,以下公式是我当前对参考列的输入,这会产生错误。

 =INDEX(F5:F10,MATCH(A5:A10,A5:A10,0))

在此处输入图片说明

Based on Edit, you could use a formula like 根据编辑,您可以使用以下公式

=LOOKUP(2,1/(F5:F10=$A$5:$A$10),F5:F10)

Copy it across! 复制过来!

If there's going to only one entry and others as dash (-) then following can also be used. 如果仅要输入一个条目,而其他条目则用破折号(-)表示,则也可以使用以下内容。

=SUBSTITUTE(CONCATENATE(F5,F6,F7,F8,F9,F10),"-","")

Explanation for LOOKUP: LOOKUP的说明:

We simply compare values in formula column (F in this case) with values in Column A by using (F5:F10=$A$5:$A$10) which produces results like TRUE;FALSE;FALSE;FALSE;FALSE 我们只需使用(F5:F10=$A$5:$A$10)将公式列(在这种情况下为F)与列A中的值进行比较,得出的结果为TRUE;FALSE;FALSE;FALSE;FALSE

when these results are used to divide 1 then they're coerced to numbers (TRUE=1, FALSE=0) so the resultant array looks like 1,#DIV/0!;#DIV/0!;#DIV/0!;#DIV/0! 当这些结果用于除以1时,它们将被强制转换为数字(TRUE = 1,FALSE = 0),因此结果数组看起来像1,#DIV/0!;#DIV/0!;#DIV/0!;#DIV/0! .

We are looking in TRUE result which will be always equal to 1. So we are using a number larger than 1 ie 2 as LOOKUP uses binary search. 我们正在寻找始终等于1的TRUE结果。因此,我们使用的数字大于1,即2,因为LOOKUP使用二进制搜索。 Any large number can be used. 可以使用任何大数。

And then outer LOOKUP simply returns the matched item from passed array. 然后外部LOOKUP只是从传递的数组中返回匹配项。

You can precisely see this by using Formula Evaluate option in the ribbon Formulas >> Formula Auditing >> Evaulate Formula . 您可以通过使用功能区Formulas >> Formula Auditing >> Evaulate Formula评估Formulas >> Formula Auditing >> Evaulate Formula中的公式评估选项来准确地看到这一点。

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

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