Excel:为了避免#value,iferror应该返回什么?错误 [英] Excel: What should iferror return in order to avoid #value! error

查看:353
本文介绍了Excel:为了避免#value,iferror应该返回什么?错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能很简单,但是似乎我无法找到解决方案。 Google无法运行(可能是错误的关键字),无论如何:



我需要计算所有发现的vlookup结果的平均值,并忽略所有未找到的值。



我目前拥有的:

  = AVERAGE(
IFERROR VLOOKUP(A4,table01,2,0),),
IFERROR(VLOOKUP(A4,table02,2,0),),
IFERROR(VLOOKUP(A4,table03,2, 0),),
IFERROR(VLOOKUP(A4,table04,2,0),),
IFERROR(VLOOKUP(A4,table05,2,0),),
IFERROR(VLOOKUP(A4,table06,2,0),),
IFERROR(VLOOKUP(A4,table07,2,0),),
IFERROR(VLOOKUP ,table08,2,0),),
IFERROR(VLOOKUP(A4,table09,2,0),),
IFERROR(VLOOKUP(A4,table10,2,0) ),
IFERROR(VLOOKUP(A4,table11,2,0),),
IFERROR(VLOOKUP(A4,table12,2,0),)

每一行都可以正常工作,但平均值总是会导致#价值!如果在许多表格中找不到该值,则会出错。如果没有找到IFERROR返回我。



为了使平均值工作,我应该在IFERROR字段中输入 p>


  • 用0替换这个值会计算值并降低平均值,不应该



谢谢

解决方案

我对Ron的建议感兴趣。

如您在答案中所述,您需要制作120个帮助列。

在我看来,您只需要一个12 x 10的辅助单元格矩阵。

而您只需要一个公式。



考虑这个简单的示例数据:





您正在寻找平均值所有3个表中的 Data1 的Value1和Value2)如图所示。

所以就像在每个表中看到3个表,每列有2列。

用Ron的建议,将需要6个不同的帮助列公式。



这是我的建议。

让我们创建一个帮助矩阵,如下所示:





我们使用下面的公式来创建矩阵:



= IFERROR(VLOOKUP(A2,INDIRECT({Table1,表2,Table3}),{2; 3},0),)



em>数组公式。



首先选择 D7:F8 (您的矩阵),然后单击公式栏并输入公式。

使用 Ctrl + Shift + 输入。输入数组公式

检查矩阵,它返回我们需要的所有值:





它返回没有找到。

一旦帮助矩阵完成,您可以简单地:



= AVERAGE(D7:F8 )

= AVERAGE(matrix)(如果您要创建一个命名范围对于您的矩阵)



B2 中,基于我们的示例数据布局。结果将是3.

HTH。这真的取决于你更容易设置。


This is probably smth simple, but seems I'm unable to find out the solution. Googled with no luck (probably wrong keywords), anyway:

I need to count the average of all found vlookup results and ignore all values that were not found.

what i currently have:

 = AVERAGE(
    IFERROR(VLOOKUP(A4,table01,2,0),""),
    IFERROR(VLOOKUP(A4,table02,2,0),""),
    IFERROR(VLOOKUP(A4,table03,2,0),""),
    IFERROR(VLOOKUP(A4,table04,2,0),""),
    IFERROR(VLOOKUP(A4,table05,2,0),""),
    IFERROR(VLOOKUP(A4,table06,2,0),""),
    IFERROR(VLOOKUP(A4,table07,2,0),""),
    IFERROR(VLOOKUP(A4,table08,2,0),""),
    IFERROR(VLOOKUP(A4,table09,2,0),""),
    IFERROR(VLOOKUP(A4,table10,2,0),""),
    IFERROR(VLOOKUP(A4,table11,2,0),""),
    IFERROR(VLOOKUP(A4,table12,2,0),"")
)

Each single line works fine, but the average will always results in a #Value! error if the value was not found in one of the many tables. If not found IFERROR returns me "".

What should i put instead of "" in the IFERROR field in order for the average to work?

  • Replacing this with 0 would count the values and lower the average, which shouldn't

THANK YOU

解决方案

I got interested in Ron's suggestion.
As you've commented in his answer, you need to make 120 helper columns to do it.
In my opinion, you only need a 12 x 10 helper cell matrix.
And you only need one formula.

Consider this simple sample data:

You are looking for the average value(both Value1 and Value2) of Data1 in all 3 tables as shown.
So it's like looking through 3 tables with 2 columns in each.
With Ron's suggestion, it will need 6 helper columns with 6 different formula.

Here's my suggestion though.
Let us create a helper matrix as seen below:

We use below formula to create the matrix:

=IFERROR(VLOOKUP(A2,INDIRECT({"Table1","Table2","Table3"}),{2;3},0),"")

which is an Array Formula.

First select D7:F8 (your matrix) and then click on the formula bar and enter the formula.
Enter it as Array Formula using Ctrl+Shift+Enter.

Examining the matrix, it returns all the value we need:

It returns "" for values that are not found.
Once the helper matrix is done, you can simply put:

=AVERAGE(D7:F8) or
=AVERAGE(matrix) (if you want to create a Named Range for your matrix)

in B2 based on our sample data layout. The result will be 3.
HTH. It's really up to you which is easier to set up.

这篇关于Excel:为了避免#value,iferror应该返回什么?错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆