user2326092
user2326092

Reputation: 51

If Statement & Countif combined

in column B I have "CM" in a range =COUNTIF(B:B,"CM") will return the total count of all cells that contain "CM"

I need to take it one more step. where column B contains CM I need to count the range in column H only if the range in H has data/text

Thanks David

Upvotes: 0

Views: 23594

Answers (2)

Mark Fitzgerald
Mark Fitzgerald

Reputation: 3068

Change your formula to a COUNTIFS which takes multiple parameter sets and use the second parameter set to test if column H has no value/text

=COUNTIFS(B:B,"CM",H:H,"<>")

Note, this doesn't exclude the possibility that cells in column H may contain a formula. That's a question I can't answer.

I'm not sure if you wanted to count cells in column B that equal "CM" or contain "CM". Your formula will count any cells that equal upper or lower case "cm" (or any combination thereof). If you really want cells containing "CM", wrap it in asterisks

=COUNTIFS(B:B,"*CM*",H:H,"<>")

Upvotes: 2

Tim Williams
Tim Williams

Reputation: 166306

Try this:

=COUNTIFS(B:B,"CM", H:H, "*")

Upvotes: 1

Related Questions