'Attempting to fashion (Google Sheets)...IF search within a range is true, COUNT all occurances of search in the range AND decrease by 1, if false, 0

Example long hand formula:
IF "text_1" [a cell reference] appears in this range [a column range], COUNT all occurances of "text_1" in the range and decrease by 1, if "text_1" [the cell reference] does not appear, 0.

I've tried: =countif(C$2:C$15,$A17)-1 YET, when A17 does not appear in C2:C15, the result is -1. I need 0.

Any assistance would be greatly appreciated. Thanks!!



Solution 1:[1]

try:

=MAX(COUNTIF(C2:C15, A17)-1, 0)

note that if there will be 1 match final result will be zero too

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 player0