How to count unique values in Excel with two conditions

前端 未结 3 1125
终归单人心
终归单人心 2020-12-04 02:50

I know there is already a question that has been answered about counting uniques with a condition (Count Unique values with a condition), but I want to know how to count uni

3条回答
  •  粉色の甜心
    2020-12-04 03:10

    The formula I suggested in the link is this

    =SUM(IF(FREQUENCY(IF(B2:B100=1,IF(A2:A100<>"",MATCH(A2:A100,A2:A100,0))),ROW(A2:A100)-ROW(A2)+1),1))

    that counts different values in A2:A100 if B2:B100 =1

    You can just add more IFs with more conditions, making sure you get the requisite number of parentheses in the correct locations, e.g. for the number of different owners by city and month try this version for March in Chicago

    =SUM(IF(FREQUENCY(IF(City="Chicago",IF(Month="March",IF(Owner<>"",MATCH(Owner,Owner,0)))),ROW(Owner)-MIN(ROW(Owner))+1),1))

    confirmed with CTRL+SHIFT+ENTER

提交回复
热议问题