跳到主要內容

如何使用Excel中的條件對過濾後的數據/列表進行計數?

您可能會注意到,無論您是否過濾了表格,COUNTIF函數都會忽略過濾並返回固定值。 在某些情況下,您需要根據特定條件對過濾的數據進行計數,那麼如何完成呢? 在本文中,我將介紹幾種在Excel中快速過濾Countif過濾數據/列表的方法。


Countif 通過在 Excel 中添加幫助列來使用條件篩選數據

在本文中,我將以下表為例。 在這裡,我在 Salesman 列中過濾掉了 Julie 和 Nicole。

原始數據:

過濾數據:

此方法將引導您添加一個額外的幫助列,然後您可以應用 COUNTIFS 函數對 Excel 中的過濾數據進行計數。 (備註:此方法要求您在執行以下步驟之前過濾原始表。)

1. 在原始過濾表之外找到一個空白單元格,比如說單元格 G2,輸入 = IF(B2 =“ Pear”,1,“”),然後將“填充手柄”拖動到所需的範圍。 (注意: 在公式 = IF(B2 =“ Pear”,1,“”),B2是您要計算的單元格,“ Pear”是您要計算的標準。)

現在除了原始過濾表之外,還添加了一個輔助列。 “1”表示它在 B 列中是梨,而空白表示它在 B 列中不是梨。

2。 找到一個空白單元格並輸入公式 =COUNTIFS(B2:B18,"Pear",G2:G18,"1"),然後按 Enter 鍵。 (注意: 在公式 =COUNTIFS(B2:B18,"Pear",G2:G18,"1"),B2:B18和G2:G18是您要計算的範圍,“ Pear”和“ 1”是您要計算的標準。)

現在您將立即獲得計數。 請注意計數 不會改變 如果您禁用過濾或更改過濾。

僅在指定範圍內對可見單元格進行求和/計數/平均,而忽略隱藏或過濾的單元格/行/列

通常,SUM / Count / Average函數將對是否隱藏/過濾的物質像元計數指定範圍內的所有像元。 小計功能只能忽略隱藏的行來求和/計數/求平均值。 但是,Kutools for Excel 可見的/清晰可見/平均可見度 函數將忽略任何隱藏的單元格,行或列,輕鬆地計算指定範圍。


廣告總數僅計算平均可見單元格

通過Excel函數使用條件對Countif過濾的數據

如果希望計數隨著過濾器的變化而變化,則可以在Excel中應用SUMPRODUCT函數,如下所示:
在空白單元格中輸入公式 =SUMPRODUCT(SUBTOTAL(3,OFFSET(B2:B18,ROW(B2:B18)-MIN(ROW(B2:B18)),,1)),ISNUMBER(SEARCH("Pear",B2:B18))+0),然後按 Enter 鍵。

注意絲帶 公式太難記了嗎? 將公式另存為“自動文本”條目,以供日後再次使用!
閱讀全文...     免費試用

筆記:
(1)在上面的公式中,B2:B18是您要計算的範圍,“ Pear”是您要計算的條件。
(2) 返回值 將改變 當您禁用過濾或過濾更改時。

根據Excel列中的條件輕鬆將範圍分為多個工作表

與復雜的數組公式相比,將所有過濾後的記錄保存到新工作表中,然後應用Count函數對過濾後的數據范圍或列表進行計數可能要容易得多。

Kutools for Excel的 拆分數據 實用程序可以幫助Excel用戶根據原始範圍的一列中的條件輕鬆地將範圍分為多個工作表。


廣告分割數據0


相關文章

最佳辦公生產力工具

🤖 Kutools 人工智慧助手:基於以下內容徹底改變數據分析: 智慧執行   |  生成代碼  |  建立自訂公式  |  分析數據並產生圖表  |  呼叫 Kutools 函數...
熱門特色: 尋找、突出顯示或識別重複項   |  刪除空白行   |  合併列或儲存格而不遺失數據   |   沒有公式的回合 ...
超級查詢: 多條件VLookup    多值VLookup  |   跨多個工作表的 VLookup   |   模糊查詢 ....
高級下拉列表: 快速建立下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
欄目經理: 新增特定數量的列  |  移動列  |  切換隱藏列的可見性狀態  |  比較範圍和列 ...
特色功能: 網格焦點   |  設計圖   |   大方程式酒吧    工作簿和工作表管理器   |  資源庫 (自動文字)   |  日期選擇器   |  合併工作表   |  加密/解密單元格    按清單發送電子郵件   |  超級濾鏡   |   特殊過濾器 (過濾粗體/斜體/刪除線...)...
前 15 個工具集12 文本 工具 (添加文本, 刪除字符,...)   |   50+ 圖表 類型 (甘特圖,...)   |   40+ 實用 公式 (根據生日計算年齡,...)   |   19 插入 工具 (插入二維碼, 從路徑插入圖片,...)   |   12 轉化 工具 (數字到單詞, 貨幣兌換,...)   |   7 合併與拆分 工具 (高級合併行, 分裂細胞,...)   |   ... 和更多

使用 Kutools for Excel 增強您的 Excel 技能,體驗前所未有的效率。 Kutools for Excel 提供了 300 多種進階功能來提高生產力並節省時間。  點擊此處獲取您最需要的功能...

產品描述


Office選項卡為Office帶來了選項卡式界面,使您的工作更加輕鬆

  • 在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。
  • 在同一窗口的新選項卡中而不是在新窗口中打開並創建多個文檔。
  • 將您的工作效率提高 50%,每天為您減少數百次鼠標點擊!
Comments (17)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
When i change the filter, the count will change automatically ?
This comment was minimized by the moderator on the site
Is there a way to modify the formula for filtered data if I'm wanting to gather the information but for both pears and oranges?
This comment was minimized by the moderator on the site
Hi there,

With the first method, you can enter the following formula in the helper column: =IF(B2="Pear",1,IF(B2="Orange",1,"")
And then use the following formula to get the total count: =COUNTIFS(G2:G18,1)

Amanda
This comment was minimized by the moderator on the site
Sweet, this works!
This comment was minimized by the moderator on the site
hey i want to count value greater than 1 but with filtered visible data, can you help?
This comment was minimized by the moderator on the site
Hi,
I need help calculating the percentage of PP students (column F) with SEN (column E) who have s or b (column G)

Here's the formula I've been trying to use but it's not working.

Any help/advice appreciated.

=SUMPRODUCT(ISNUMBER(MATCH($E$2:$E$30,{"<>"},0))*ISNUMBER(MATCH($F$2:$F$30,{"<>"},0))*ISNUMBER(MATCH($T$2:$T$30,{"s","b"},0)))/SUMPRODUCT(ISNUMBER(MATCH($E$2:$E$30,{"<>"},0))*ISNUMBER(MATCH($F$2:$F$30,{"<>"},0)))

Claire
This comment was minimized by the moderator on the site
How about if “pear” needs to be a number value “<0” what do you use instead of (search?
This comment was minimized by the moderator on the site
Hi Sib,
You can apply the COUNTIFS functions to count items with two or more criteria. In the case of this webpage, you can use the formulas =COUNTIFS(B2:B21,"Pear",C2:C21,"<0") to count the pears whose amount is less than 0.
However, the count result is solid and won’t change when you change the filter.
This comment was minimized by the moderator on the site
Thanks a lot. It's really excellent! Thanks once a lot.
This comment was minimized by the moderator on the site
Excellent!!! Now able to filter and countif based on creiteria.
This comment was minimized by the moderator on the site
How would I add another criteria to the filtered data formula?
This comment was minimized by the moderator on the site
Hi Kane,
Which kind of filter criteria do you want to add? More detailed information can help we understand and solve your problem quicker.
This comment was minimized by the moderator on the site
Same with my question. How to count filtered if there are two criteria "Pear" for fruit and "Julie" for salesman?

Thanks.
This comment was minimized by the moderator on the site
Hi,
In this situation, I guess a helper column I introduced in the first method may be easier to count.
This comment was minimized by the moderator on the site
AWESOME, I used the formula, and it was exactly what I need. thanks!!
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations