问题
I am trying to return by Excel function a count of all the rows in column A where the text (CLOSED)
or (DO NOT USE)
is contained. All rows will contain other values too like so:
Row 1 = Nice Day (CLOSED)
Row 2 = Hello (CLOSED)
Row 3 = Cats & DOGS (CLOSED)
Row 4 = Cats (DO NOT USE)
so I need to search for the keywords (closed)
or (do not use)
in amongst the text.
Here's what I've tried to do so far but it doesn't work:
=COUNTIF(Sheet2!A2:A3187,"(CLOSED)")
Please can someone point me into the right direction?
回答1:
Please try:
=COUNTIF(A:A,"*(CLOSED)*")+COUNTIF(A:A,"*(DO NOT USE)*")
回答2:
You need to place a wild card in your expression.
If you want to match (CLOSED)
anywhere in the string:
=COUNTIF(A:A,"*(CLOSED)*")
If you only want to match it at the end:
=COUNTIF(A:A,"*(CLOSED)")
来源:https://stackoverflow.com/questions/28746408/count-all-rows-in-column-a-containing-closed-or-do-not-use