VBA Count cells in column containing specified value

后端 未结 5 1348
既然无缘
既然无缘 2020-12-08 07:11

I need to write a macro that searches a specified column and counts all the cells that contain a specified string, such as \"19/12/11\" or \"Green\"

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-08 07:29

    Not what you asked but may be useful nevertheless.

    Of course you can do the same thing with matrix formulas. Just read the result of the cell that contains:

    Cell A1="Text to search"
    Cells A2:C20=Range to search for

    =COUNT(SEARCH(A1;A2:C20;1))
    

    Remember that entering matrix formulas needs CTRL+SHIFT+ENTER, not just ENTER. After, it should look like :

    {=COUNT(SEARCH(A1;A2:C20;1))}

提交回复
热议问题