# Counting 2 different Columns?

Options

I am in need of some help. I can't seem to figure out how I am to get a count of how many people selected a certain salad with a certain protein. I have one column that participants are picking a lunch item. Two of those items are salads. I put the formula =COUNTIF([Sunday, January 23rd Lunch]:[Sunday, January 23rd Lunch], CONTAINS("Winter grains", @cell)) to know how many people selected the Winter Grains Salad. That works. Then they also selected a protein to go with the salad. I am needing to know how many people that selected the Winter Grains Salad wanted Salmon with their salad. So for instance, 4 people selected Winter Grain Salad I am needing to know out of those 4 who chose salmon for their protein. I tried combining the formulas together but I am getting an error response in the cell.

• ✭✭✭✭✭✭
Options

If so then you can use the COUNTIFS function.

=COUNTIFS([Sunday, January 23rd Lunch]:[Sunday, January 23rd Lunch], CONTAINS("Winter grains", @cell),[Salad Protein Option]:[Salad Protein Option],CONTAINS("Salmon", @cell))

• ✭✭✭✭✭✭
Options

See below how you can use the AND function to do this.

=COUNTIF([Sunday, January 23rd Lunch]:[Sunday, January 23rd Lunch], and(CONTAINS("Winter grains", @cell),CONTAINS("Salmon", @cell)))

• Options

The Salmon is in a different Column Labeled Salad Protein Option so this equation works but not for to provide the result I am looking for.

• ✭✭✭✭✭✭
Options

If so then you can use the COUNTIFS function.

=COUNTIFS([Sunday, January 23rd Lunch]:[Sunday, January 23rd Lunch], CONTAINS("Winter grains", @cell),[Salad Protein Option]:[Salad Protein Option],CONTAINS("Salmon", @cell))

• Options

Thank you! It works!

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!