简体   繁体   English

Excel公式用于在另一列中满足条件时对一列中的行进行计数

[英]Excel Formula to count rows in a column when a criteria is met in another column

I have two sheets "Aug" & "Dashboard." 我有两个工作表“八月”和“仪表板”。 The "Aug" sheet it is always growing and it has multiple columns, but the important ones are "Week" (Week is in B3) and "Group" (in C3). 它始终在增长的“ Aug”表中有多列,但重要的是“ Week”(周在B3中)和“ Group”(在C3中)。

I am able to do a formula that will count if any row in the "Group" column has the word "Harvest". 我能够执行一个公式,该公式将计算“组”(Group)列中的任何行是否包含单词“ Harvest”。 =COUNTIF(Aug!C3:Aug!C1301,"Harvest") = COUNTIF(八月C3:!八月C1301, “收获”)

But, I would also like to be able to count the number of times Harvest shows up depending on the week and to put that information in a certain cell in the "Dashboard" Sheet. 但是,我还希望能够根据周数计算Harvest出现的次数,并将该信息放入“仪表板”表中的某个单元格中。

Here is what the "Aug" sheet could look like 这是“ Aug”表的外观

Week Group 
31   harvest
31   harvest
31   rqst
31   harvest
32   harvest
32   harvest

The "Dashboard" sheet has a cell (A35) where you type in the week you want to look at. “仪表板”表上有一个单元格(A35),您可以在其中键入要查看的星期。 For example if I want the sheet to count how many times the word harvest shows up in week 31 then I would type 31 and I should expect the number 3 to turn up. 例如,如果我希望工作表统计第31周出现“收获”一词的次数,则输入31,然后我期望数字3会出现。

I tried using a countif formula and an if formula, but that didn't work for me. 我尝试使用countif公式和if公式,但这对我不起作用。 Here is the formula that I tried using. 这是我尝试使用的公式。

=IF(Dashboard!A36=Aug!B4:AugB1301, COUNTIF(Aug!C4:Aug!C1302,"Harvest")) = IF(仪表板!A36 = Aug!B4:AugB1301,COUNTIF(Aug!C4:Aug!C1302,“收获”)))

I get a #name! 我得到一个#name! error. 错误。

I then tried focusing on just one cell to see but I can't even get that to pull correctly. 然后,我尝试只关注一个单元格,但我什至无法正确拉动它。

=IF(Dashboard!A36=Aug!B1302, COUNTIF(Aug!C4:Aug!C1302,"Harvest")) = IF(仪表板!A36 =八月!B1302,COUNTIF(八月!C4:八月!C1302,“收获”)))

So What I understand from my formula is that If the number in cell A35 matches a the cell in the Aug sheet b1302, the it should count the entire column C and count how many times the word harvest comes up. 所以我从公式中了解到的是,如果单元格A35中的数字与8月工作表b1302中的单元格相匹配,则该单元格应该计算整个C列,并计算单词收获出现的次数。 I keep getting a False statement. 我不断收到错误的陈述。

I can make the countif statement work on it's own. 我可以自己执行countif语句。 I can use the count if statement to give me a total of "harvest" in the entire column. 我可以使用count if语句在整列中总计获得“收获”。

I want it to count per the week i tell it to. 我想按每周告诉我一次。

Snippet of my Dashboard sheet 我的仪表板摘要

Example of my Aug Sheet where I want to focus on just one cell 我的Aug表的示例,我只想关注一个单元格

And, if there is a VBA code that does this then it will be so much better because I will be able to have the formulas hidden. 而且,如果有执行此操作的VBA代码,那就会好得多,因为我将能够隐藏公式。

Thank you 谢谢

带有S COUNTIFS()允许多个条件:

=COUNTIFS(Aug!C3:Aug!C1301,"Harvest",Aug!B3:Aug!B1301,Dashboard!A36)

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

相关问题 Excel VBA:满足条件时将列复制到另一个工作表 - Excel VBA: Copying a column to another sheet when criteria is met 我正在寻找一个 excel 公式,以在另一列中的条件都满足时获取唯一客户端 ID 的计数 - I'm looking for an excel formula to get a count of unique client ID's when a condition in another column are all met 使用另一列上的条件计算 excel 中的不同值 - Count distinct values in excel with criteria on another column 在Excel的另一列中添加符合条件的行 - Adding rows that match a criteria in another column in Excel 当我们满足另一列中的条件时,我需要在Excel中的一列中计算值 - I need to count values in one column in Excel when they meet criteria in another column 是否有 excel 公式来计算当另一列中的值为 YES 时 ID 在列中出现的次数? - Is there a excel formula to count how many times an ID appears in a column when the value in another column is YES? 复制公式以计算具有值的行数到excel中的另一列 - Copying formula to count the number of rows which have a value to another column in excel 用更改Excel中的列的条件进行计数 - Count with criteria for changing column in excel 在满足条件的情况下切换 SUMIF 公式中的总和列 - Switch sum column in SUMIF formula in case criteria is met 如果 A 列或 B 列满足条件,则计算行数 - Count Rows If Column A OR Column B meet criteria
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM