# How to use the COUNTIF formula when you have an OR statement that looks at multiple columns

Options
✭✭✭✭

I am trying to come up with a formula that will calculate how many tasks I have that are either "At Risk", which is a checkbox (flag) column, or has red health, which is a symbol column. I need a formula that does not add the totals of those conditions. For example, if a task is both At Risk and red health, I want that to be counted as 1 instead of 2. The formula I initially started with is:

I have tried different COUNTIFS formulas and even tried to use [At Risk]@row and Health@row and it still gave me error each time.

I thought this would be a simple formula, but of course, it isn't.

Tags:

• ✭✭✭✭✭✭
Options

You would have to COUTNIFS flags, add that to COUNTIFS "Red" then subtract from the the COUNTIFS both.

=COUNTIFS([At Risk]:[At Risk], @cell = 1) + COUNTIFS(Health:Health, @cell = "Red") - COUNTIFS([At Risk]:[At Risk], @cell = 1, Health:Health, @cell = "Red")

• ✭✭✭✭✭✭
Options

You would have to COUTNIFS flags, add that to COUNTIFS "Red" then subtract from the the COUNTIFS both.

=COUNTIFS([At Risk]:[At Risk], @cell = 1) + COUNTIFS(Health:Health, @cell = "Red") - COUNTIFS([At Risk]:[At Risk], @cell = 1, Health:Health, @cell = "Red")

• ✭✭✭✭
Options

Thanks @Paul Newcome. This worked perfectly.

• ✭✭✭✭✭✭
Options

Happy to help. 👍️

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!