# How to count cells that contains certain letter

Options
✭✭

Hello,

I have seen different topics how to set up a formula that counts all the cells that contains a certain word, but those formulas does not work when there is one letter next to a number. There will be a day when there would be up to 50 rows with ' D12; N12; D5; D7; N9' and so on in each cell. I want to set up a cell that counts total D's and N's no matter whats the number next to it:

The only formula that works for me right now is:

=COUNTIF([01-Sep]4:[01-Sep]5, "D12")

but it would be long one since I would have to set up for each number (D1; D2; D3 .... up to D17). Wanted to ask you if there is way easier formula for this?

Many thanks!

• ✭✭✭✭✭
Options

COUNTIFS along with CONTAINS will do the trick

=COUNTIFS(Searchcolumn:searchcolumn, OR(CONTAINS("D", @cell), CONTAINS("N", @cell)))

• ✭✭
Options

Hello Dan,

I did not include that part with CONTAINS("N", @cell), since I want those Ns to be counted below the onee that counts Ds. Problem is, your provided formula shows me 0 although there is 4 D's in the selected range..

• ✭✭✭✭✭
edited 06/10/22
Options

The @cell needs to remain in the OR(CONTAINS("D", @cell)

=COUNTIFS([01-Sep]4:[01-Sep]8, (CONTAINS("D", @cell)))

• ✭✭
Options

Oh, that is a gamechanger then. It works now, thank you!

• ✭✭✭✭✭
Options

Cool deal! Glad I could help!

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!