简体   繁体   English

结合COUNT IF和VLOOK UP EXCEL

[英]Combining COUNT IF AND VLOOK UP EXCEL

I have multiple spreadsheets in a workbook and I would like the following in basic English talk: 我在workbook有多个电子表格,我希望在基本的English会话中有以下内容:

IF worksheet1(cell)A3 , appears in 'worksheet2' column B - count how many times it appears in column b 'worksheet 2' IF worksheet1(cell)A3出现在“工作表2”列B中 - 计算它在“工作表2”列中出现的次数

So in other words - Lets say A3 = BOB smith - in work sheet 1 and appears 4 times in worksheet 2 - I want the formula to count the fact that A3 'Bob smith' is in worksheet 2 4 times, and come back and tell me 4. 因此,换句话说-可以说, A3 = BOB史密斯-在工作表1,并出现4次在工作表2 -我希望公式来计算一个事实,即A3 “鲍勃·史密斯是在工作表2的4倍,并回来告诉我4。

I have attempted to do separate calculations - with use of Vlookups - then in another cell to count/do if statement for example 我试图进行单独的计算 - 使用Vlookups - 然后在另一个单元格中计算/执行if语句

=COUNTIF(VLOOKUP(A9,'To retire'!J:J,9,1))
=IF(J228=O233, 'worksheet2'!F440,0)
=VLOOKUP(A3,'worksheet2'!A:A,1,1)

Help would be very much appreciated, I am very stuck - I am unsure if I am looking into this too deeply or not enough! 非常感谢帮助,我很困惑 - 我不确定我是否对此深入研究或不够深入! Thank you in advance 先感谢您

This is trivial when you use SUMPRODUCT . 当您使用SUMPRODUCT时,这是微不足道的。 Por ejemplo: 来自ejemplo:

=SUMPRODUCT((worksheet2!A:A=A3)*1)

You could put the above formula in cell B3, where A3 is the name you want to find in worksheet2 . 您可以将上面的公式放在单元格B3中,其中A3是您要在worksheet2找到的名称。

=COUNTIF() Is the function you are looking for = COUNTIF()是您正在寻找的功能

In a column adjacent to Worksheet1 column A: 在与Worksheet1列A相邻的列中:

=countif(worksheet2!B:B,worksheet1!A3)

This will search worksheet 2 ALL of column B for whatever you have in cell A3 这将搜索工作表2列B中的所有内容,无论您在单元格A3中拥有什么

See the MS Office reference for =COUNTIF(range,criteria) here ! 请在此处查看MS Office参考= COUNTIF(范围,标准)!

You can combine this all into one formula, but you need to use a regular IF first to find out if the VLOOKUP came back with something, then use your COUNTIF if it did. 你可以把这一切都合并到一个公式中,但你需要首先使用常规的IF来查明VLOOKUP是否带回来了,然后使用你的COUNTIF如果有的话)。

=IF(ISERROR(VLOOKUP(B1,Sheet2!A1:A9,1,FALSE)),"Not there",COUNTIF(Sheet2!A1:A9,B1))

In this case, Sheet2-A1:A9 is the range I was searching, and Sheet1-B1 had the value I was looking for ("To retire" in your case). 在这种情况下, Sheet2-A1:A9是我正在搜索的范围, Sheet1-B1具有我正在寻找的值(在您的情况下为“退休”)。

尝试这个:

=IF(NOT(ISERROR(MATCH(A3,worksheet2!A:A,0))),COUNTIF(worksheet2!A:A,A3),"No Match Found")

If your are referring to two worksheets please use this formula 如果您指的是两个工作表,请使用此公式

=COUNTIF(Worksheet2!$A$1:$A$50,Worksheet1cellA1)

In case referring to to more than two worksheets please use this formula 如果涉及两个以上的工作表,请使用此公式

=COUNTIF(Worksheet2!$A$1:$A$50,Worksheet1cellA1)+=COUNTIF
(Worksheet3!$A$1:$A$50,Worksheet1cellA1)+=
               COUNTIF(Worksheet4!$A$1:$A$50,Worksheet1cellA1)

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

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