匹配时,INDEX MATCH返回#Value

时间:2019-11-04 09:50:31

标签: excel excel-formula

我在表 tbl_attrib_ytd 中的索引匹配功能遇到了一些麻烦。我正在使用数组公式CTRL + SHIFT + ENTER,当我使用公式进行扇区分配时,如下所示,该公式有效,我得到了正确的值。

{=INDEX(tbl_ytd[Sector Allocation],MATCH([@[ Sector]],tbl_ytd[Description],0),tbl_ytd[Sector Allocation])}

但是,当我使用公式

{=INDEX(tbl_ytd[Security Selection],MATCH([@[ Sector]],tbl_ytd[Description],0),tbl_ytd[Security Selection])}

我收到一个错误#VALUE!。如果我省略使用数组公式,则在某些情况下会得到匹配,但在其他情况下仍会出错。匹配查询值直接从我要查看的表中粘贴,因此应该没有差异。

tbl_attrib_ytd

|     Sector                  | Sector      Allocation | Security      Selection |
|-----------------------------|:----------------------:|:-----------------------:|
| Canadian Equity             |          0.00%         |         #VALUE!         |
| Communication               |         -0.05%         |         #VALUE!         |
| Consumer Discretionary      |          0.13%         |         #VALUE!         |
| Consumer Staples            |          0.36%         |         #VALUE!         |
| Energy                      |         -0.08%         |         #VALUE!         |
| Equity Options /   Warrants |          0.00%         |         #VALUE!         |
| Financials                  |          0.21%         |         #VALUE!         |
| Health Care                 |          0.43%         |         #VALUE!         |
| Industrials                 |         -0.16%         |         #VALUE!         |
| Info Tech                   |         -0.53%         |         #VALUE!         |
| Japanese Equity             |          0.00%         |         #VALUE!         |
| Materials                   |         -0.02%         |         #VALUE!         |
| Real Estate                 |         -0.04%         |         #VALUE!         |
| Utilities                   |          0.07%         |         #VALUE!         |
| Open End                    |         -0.01%         |         #VALUE!         |
| Other                       |          0.14%         |         #VALUE!         |
| Unassigned                  |          0.00%         |         #VALUE!         |

tbl_ytd

    | Description                 | Level | Sector  Allocation | Security   Selection | Total Effect |
    |-----------------------------|:-----:|:------------------:|:--------------------:|:------------:|
    | Canadian Equity             |   2   |        0.00%       |         0.00%        |     0.00%    |
    | Communication               |   2   |       -0.05%       |        -0.01%        |    -0.07%    |
    | Consumer   Discretionary    |   2   |        0.13%       |        -0.74%        |    -1.09%    |
    | Consumer   Staples          |   2   |        0.36%       |        -0.02%        |    -0.31%    |
    | Energy                      |   2   |       -0.08%       |         0.10%        |    -0.01%    |
    | Equity Options   / Warrants |   2   |        0.00%       |         0.00%        |     0.00%    |
    | Financials                  |   2   |        0.21%       |        -0.37%        |    -0.27%    |
    | Health Care                 |   2   |        0.43%       |        -0.89%        |     0.36%    |
    | Industrials                 |   2   |       -0.16%       |        -0.11%        |    -0.40%    |
    | Info Tech                   |   2   |       -0.53%       |        -1.06%        |    -1.79%    |
    | Japanese   Equity           |   2   |        0.00%       |         0.00%        |     0.00%    |
    | Materials                   |   2   |       -0.02%       |         0.05%        |     0.01%    |
    | Real Estate                 |   2   |       -0.04%       |         0.02%        |    -0.03%    |
    | Utilities                   |   2   |        0.07%       |        -0.06%        |    -0.04%    |
    | Open End                    |   2   |       -0.01%       |         0.00%        |    -0.01%    |
    | Other                       |   2   |        0.14%       |         0.07%        |     0.04%    |
    | Unassigned                  |   2   |        0.00%       |         0.00%        |     0.00%    |

我粘贴的最后一个表是按级别2过滤的版本。

1 个答案:

答案 0 :(得分:2)

您的公式都是错误的。 INDEX的最后一个参数是数字列。

第一个应该是(不输入数组):

=INDEX(tbl_ytd[Sector Allocation],MATCH([@[Sector]],tbl_ytd[Description],0),1)

或者只是:

=INDEX(tbl_ytd[Sector Allocation],MATCH([@[Sector]],tbl_ytd[Description],0))

,第二个应该类似:

=INDEX(tbl_ytd[Security Selection],MATCH([@[Sector]],tbl_ytd[Description],0))