# Using CountIF function to calculate Count of Market

Hi! I'm looking to get some help on a CountIF formula. I have a sheet "Territory 4 Exit Interview Pivot Table" which I am looking to get a count of how many employees are in Market 41, 42, 43, and 44 (from the T4 Exit Interview Results sheet screenshot). I keep getting all sorts of errors when trying to use the CountIF formula.

One thing to note is that the Market is populated with a V Lookup Formula, coming from this other sheet (V Lookup list for market and district). Not sure if that is the reason of the error.

Would love if someone could advise on this CountIF formula.

Thank you!

Tags:

• ✭✭✭✭✭✭

Hi @Lisa Roquemore

Hope you are fine, could you please unhide the column names so i can check the formula for you. and if you write the formula you are using it will help me to identify what is the problem.

[email protected]

• ✭✭✭✭✭✭

To keep it all in the parent row, I would use:

=COUNTIFS({Other Sheet Market Column}, OR(@cell = "41", @cell = "42", @cell = "43", @cell = "44")

My suggestion to increase flexibility would be to count each of the markets separately in the child rows and then use

=SUM(CHILDREN())

in the parent row.

Child rows:

=COUNTIFS({Other Sheet Market Column}, Category@row)

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!