Count paired instances where their elements are in different columns

人盡茶涼 提交于 2019-12-20 07:09:27

问题


My searches for answers have been limited by my lack of knowledge of the appropriate terminology. My goal is to count the number of times a specific username appears in one column AND the number 1 appears in another column for that user. I attempted to use COUNTIF, but it doesn't seem to format for that purpose.

What I'm needing is to count the number of instances "username" appears in column K when "1" appears in column Q.


回答1:


If you have =COUNTIFS (you don't mention which version of Excel) please try, in Row1 and copied down to suit:

=COUNTIFS(Q:Q,1,K:K,K1)  

there may be better ways (eg a PivotTable, an array formula or =SUMPRODUCT) but this could be one of the simplest.

Alternatively of course just filter and read the count in the bottom left-hand corner of your screen.

Showing COUNTIFS, SUMPRODUCT, PivotTable and filter options:

In this special case, because one of your criteria is 1, you might also use SUMIFS.

Because the data happens to start with a list of unique Users in order the COUNTIFS version in Row2 (adjusted to K2 from K1) entered with Ctrl+Shift+Enter and copied down to Row 6 will show a result similar to that in the PT.



来源:https://stackoverflow.com/questions/20749406/count-paired-instances-where-their-elements-are-in-different-columns

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!