简体   繁体   English

根据 Excel 中的特定值查找行名

[英]Find row name based on specific value in Excel

I have a matrix dataset with values in Excel, where row and column names are identical.我有一个矩阵数据集,其值在 Excel 中,其中行名和列名相同。 I have put all matrix values in a single column, but would now like a formula that returns the matching row name and/ or column name for that value.我已将所有矩阵值放在一个列中,但现在想要一个返回该值的匹配行名称和/或列名称的公式。 I have tried VLOOKUP and versions of INDEX and MATCH, but can't get it to work.我已经尝试过 VLOOKUP 以及 INDEX 和 MATCH 的版本,但无法使其正常工作。

Here's an illustration of the data:这是数据的说明:

在此处输入图像描述

You are not looking for a rowname or a columnname, you are looking for the content of the first row or column:您不是在寻找行名或列名,而是在寻找第一行或第一列的内容:

Imagine you want to know the "columnname" of cell "C4", then you just ask for Cell(3,1) (3 meaning "C").想象一下,您想知道单元格“C4”的“列名”,然后您只需询问Cell(3,1) (3 表示“C”)。
Imagine you want to know the "rowname" of cell "C4", then you just ask for Cell(1,4) .想象一下,您想知道单元格“C4”的“行名”,然后您只需询问Cell(1,4)

Setup:设置:

Source table range A1:D4源表范围 A1:D4

在此处输入图像描述

Values populated in column H for checking. H 列中填充的值用于检查。

Formula in cell F2:单元格 F2 中的公式:

=IFERROR(INDEX($A$1:$A$4,MIN(IF($B$2:$D$4=H2,ROW($B$2:$D$4),10^10))),"")

Formula in cell G2:单元格 G2 中的公式:

=IFERROR(INDEX($A$1:$D$1,1,MIN(IF($B$2:$D$4=H2,COLUMN($B$2:$D$4),10^10))),"")

Depending on your version, you may have to use CTRL+SHIFT+ENTER to implement these formulas.根据您的版本,您可能必须使用 CTRL+SHIFT+ENTER 来实现这些公式。 Output will be like below. Output 如下所示。

在此处输入图像描述

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

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