How to define a non continuous range in COUNTIF

后端 未结 5 459
醉酒成梦
醉酒成梦 2020-12-06 05:49
   A    B   C

1  Β        Β
2  Β        Β
3  Α        Α
4  Α        Α
5  Β        Β
6  Α        Α
7  Α        B
8  Β        Β
9  Β        Β
10 Α        Α
11 Β               


        
相关标签:
5条回答
  • 2020-12-06 05:50

    As an alternative that would work for copying and pasting, you could do:

    =COUNTIF($C$1:$C$15,"B") + COUNTIF(A16,"B")
    
    0 讨论(0)
  • 2020-12-06 05:53

    Here's the formula for cell B16: =SUM(COUNTIF(INDIRECT({"C1:C15","A16"}),"B"))

    0 讨论(0)
  • 2020-12-06 05:56

    For the record, if I understand well, you want to count the value from the cell A16. But if you do such a formula:

    =COUNTIF(C1:C15,A16)
    

    You know you will have the value (here B) in cell A16, don't you?

    So the value you want to get is:

    =COUNTIF(C1:C15,A16) + 1
    

    What did I misunderstand?

    0 讨论(0)
  • 2020-12-06 05:56

    This also worked! =SUM(COUNTIF(INDIRECT({"J18","J45","J78","J112","J140","J173","J205"}),">1"))

    0 讨论(0)
  • 2020-12-06 06:15

    You can also declare a named range of non-contiguous ranges, but you must use the INDIRECT function in declaring the range. Otherwise, it will fail just like a normal, non-contiguous range.

    Declaring the range ("Range1") should have the "applies to" field read:

    =INDIRECT({"A1:B2","C4:F17"})
    

    Or use other named ranges:

    =INDIRECT({"Table1[Column1]","Table2[Column3]","Table4[Column2]")
    

    Then you can reference it like:

    =COUNTIF(Range1,"=Yes")
    
    0 讨论(0)
提交回复
热议问题