[英]Excel - VLOOKUP or COUNTIF to count Matches from 2 Columns?
我正在嘗試從兩列中獲取匹配數。 假設我有一個包含以下數據的表。
汽車
In column A I have colours of cars e.g. Red, Yellow, Black, Green
In column B I have the type of car e.g. Diesel, Automatic, Manual
我想要計算所有在柴油上運行的紅牌的數量,那么我將使用哪種功能?
Column A has 3 red cars
Column B has 6 diesel cars in total but only 1 of the red cars is a diesel.
我試過了 :
=COUNTIF(A2:A10,"Red")+COUNTIF(B2:B10,"Diesel")
但是它給出了所有紅色轎車和所有柴油轎車的總數(9),而不是所有紅色柴油車的總數,應該為1。
您可以使用=COUNTIFS()
公式:
=COUNTIFS(A1:A10,"Red",B1:B10,"Diesel")
您對每一行進行求和,然后求和。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.