# Countif and Multi line cell

✭✭✭✭

Column 1: Status

Column2: Count

Column 1: test

Column 2: =COUNTIF([BOP Status]@row, "test")

Result = 1

Column 1: 2 lines. (1st line "test" , then Alt-enter, then "found in a test"

Column 2: =COUNTIF([BOP Status]@row, "test")

Result =0

Is there something about using Alt-Enter that causes this issue? is there a work-around?

Thanks

• ✭✭✭✭✭✭

Hey @DanielGD

It's not necessarily that the Alt-Enter is causing the problem - it's that you're trying to count multiple occurrences in a text string.

There is a work-around

=(LEN([Column 1]@row) - LEN(SUBSTITUTE([Column 1]@row, "test", ""))) / LEN("test")

This is looking at the length (number of characters) of the entire string, subtracts the non "test" characters, which means what is left should be a string length in multiples of the word "test". By dividing by the test length we can see how many multiples were in the original string.

Does this work for you?

Kelly

• ✭✭✭✭✭✭

Hey @DanielGD

It's not necessarily that the Alt-Enter is causing the problem - it's that you're trying to count multiple occurrences in a text string.

There is a work-around

=(LEN([Column 1]@row) - LEN(SUBSTITUTE([Column 1]@row, "test", ""))) / LEN("test")

This is looking at the length (number of characters) of the entire string, subtracts the non "test" characters, which means what is left should be a string length in multiples of the word "test". By dividing by the test length we can see how many multiples were in the original string.

Does this work for you?

Kelly

• ✭✭✭✭

Thank you Kelly. Works perfectly!

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!