显示excel中每个不同对(2列)的运行计数

时间:2017-04-25 16:24:24

标签: excel excel-2007

我有一组值,我需要第三个值(count),它将1放在配对的最后一个不同实例上,如下所示:

A      B    Count 
apple  1      1
apple  2      1
apple  3      1
plum   1      0
plum   1      0
plum   1      1
plum   2      0
plum   2      1
plum   3      1

这在excel中是否可行?我无法使用此数据执行数据透视表,“count”列将用于其他目的。谢谢。

2 个答案:

答案 0 :(得分:2)

使用此IF / OR:

=IF(OR(A2<>A3,B2<>B3),1,0)

enter image description here

答案 1 :(得分:1)

尝试使用图片中显示的公式并将其向下拖动

=IF(COUNTIFS($A2:$A$10,A2,$B2:$B$10,B2)=1,1,0)

enter image description here