2014-09-21 101 views
0

我試圖從兩列中獲得匹配數。假設我有一個包含以下數據的表格。Excel - VLOOKUP或COUNTIF來計算來自2列的匹配項?

汽車

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

回答

0

你可以爲每一行做一個操作,然後總和。

Formulas

1

您可以使用=COUNTIFS()公式:

=COUNTIFS(A1:A10,"Red",B1:B10,"Diesel")