Excel从sumif语句获取当前行 [英] Excel Get current row in from sumif statement

查看:634
本文介绍了Excel从sumif语句获取当前行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Excel 2010,并且具有多个选项卡的数据表,这是我正在使用的当前sumif函数

  = IF(SUMIF('Master Data'!$ J $ 2:$ J $ 200,'Resource View(2)'!B22,'Master Data'!$ W $ 2:$ W $ 200)> 0,Current_row_different column, 

基本上我在另一张表中找到一些值为1的行,我想使用这些行行的值为1,但在该行中使用不同的列来填充真实条件。所以说,例如行4在列AI中包含一个1,然后想要保留在第4行,但是获取列B的值作为真实条件。



这可能吗?



任何非常感谢的建议



提前感谢



编辑:



我现在已经设法使功能工作,但它有一个excel黑客,因为我不得不在主人数据和它有点凌乱现在无论如何,我已经得到了

  = IF(SUMIF('Master Data'!$ C $ 2:$ C $ 200,'资源视图(2)'!B22,'主数据'!$ W $ 2:$ W $ 200)> 0,VLOOKUP(B22,'Master Data'!$ C $ 2:$ F $ 90, 3,FALSE),)

现在我知道这是因为VLookup通过指定的第一列进行搜索如果我尝试将范围向后,即$ F $ 90:$ C $ 2而不是$ C $ 2:$ F $ 90,它似乎不起作用。有没有办法操纵VLOOKUP这样工作?

解决方案

是的,其实有一种方法 - 一个 VLOOKUP - 它是 INDEX(MATCH())。这是一个非常有用的工具,因为您可以查看任何列并返回任何其他列,不仅查看第一个将其返回到右侧。另外, INDEX(MATCH())可以用于形成数组公式,如果需要,而 VLOOKUP 不能



基本上,这部分公式:



VLOOKUP(B22,主数据!$ C $ 2:$ F $ 90,3,FALSE)



将被更改:



INDEX('Master Data'!$ E $ 2:$ E $ 90,MATCH(B22,'Master Data'!$ C $ 2:$ C $ 90,FALSE))因此,毕竟,相当于

  = IF(SUMIF('Master Data'!$ C $ 2:$ C $ 200,'Resource View(2)'!B22,'Master Data'!$ W $ 2:$ W $ 200)> 0,VLOOKUP (B22,'Master Data'$ C $ 2:$ F $ 90,3,FALSE),)

将是

  = IF(SUMIF('Master Data'!$ C $ 2:$ C $ 200,'资源视图(2)'!B22,'Master Data'!$ W $ 2:$ W $ 200)> 0,INDEX('Master Data'!$ E $ 2:$ E $ 90,MATCH(B22,'Master Data'!$ C $ 2:$ C $ 90,FALSE)),)


Im using Excel 2010 and have a datasheet with multiple tabs, this is the current sumif function that i am using

 =IF(SUMIF('Master Data'!$J$2:$J$200,'Resource View (2)'!B22,'Master Data'!$W$2:$W$200)>0,Current_row_different column, "")

Basically I find some rows in the other sheet that have a value of 1 i then want to use these rows that have a value of 1 but use a different column within that row to populate the true condition.

So say for instance row 4 contains a 1 at column A I then want to stay on row 4 but get the value of column B for the true condition.

Is this possible?

Any suggestions much appreciated

Thanks in advance.

EDIT:

I have now managed to get the function working however its a bit of an excel hack, because I have had to move the columns around in the master data and its a bit messy now anyway heres what I've got

 =IF(SUMIF('Master Data'!$C$2:$C$200,'Resource View (2)'!B22,'Master Data'!$W$2:$W$200)>0,VLOOKUP(B22,'Master Data'!$C$2:$F$90,3,FALSE),"")

Now I know this is because VLookup searches through the first column specified and it doesnt seem to work at all if i try to put the range in backwards i.e. $F$90:$C$2 instead of $C$2:$F$90. Is there anyway to manipulate VLOOKUP to work like this?

解决方案

Yes, actually there is a way - a brother of VLOOKUP - it's INDEX(MATCH()). It is a very useful tool, as you can look at any column and return any other, not only looking at the first one to return the ones to the right. Also, INDEX(MATCH()) can be used in forming array formulas, if you need that, while VLOOKUP cannot.

Basically, this part of your formula:

VLOOKUP(B22,'Master Data'!$C$2:$F$90,3,FALSE)

would be changed with this:

INDEX('Master Data'!$E$2:$E$90,MATCH(B22,'Master Data'!$C$2:$C$90,FALSE))

So, after all, the equivalent for

=IF(SUMIF('Master Data'!$C$2:$C$200,'Resource View (2)'!B22,'Master Data'!$W$2:$W$200)>0,VLOOKUP(B22,'Master Data'!$C$2:$F$90,3,FALSE),"")

would be

=IF(SUMIF('Master Data'!$C$2:$C$200,'Resource View (2)'!B22,'Master Data'!$W$2:$W$200)>0,INDEX('Master Data'!$E$2:$E$90,MATCH(B22,'Master Data'!$C$2:$C$90,FALSE)),"")

这篇关于Excel从sumif语句获取当前行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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