# COUNT IF - CRITERIA

Options

Hello Team,

I have the following data to work on:

22-123
22-456
22-789
23-123
23-456
23-789
24-123
24-456
24-789

Where the first 22-, 23- and 24- represent 2022, 2023, 2024.

I'm trying to use the "COUNTIF" formula to count them by using, the 22, 23 and 24 as criteria, to know how many items I have per year, however it shows me 0.

How should I enter the formula to count them correctly?

Tags:

• ✭✭✭✭✭✭
Options

Hi @DG 13 , try this formula where your data is entered into a column called "Year Val":

=COUNTIF([Year Val]:[Year Val], LEFT(@cell, 2) = 22)

Let me know if further help needed!

Best,

Will

• Options

Hi @Will Jeffords , Thanks for tackling my question, the colum where I have the data is "Coded Name".

I entered your suggested formula this way: =COUNTIF([Coded Name]:[Coded Name], LEFT([Coded Name], 2) = 22) But did not work.

Any other suggestion?

• ✭✭✭✭✭✭
edited 05/18/24
Options

hi @DG 13 the second half needs to be exactly “LEFT(@cell, 2) =22)”

Try that instead of “LEFT(Coded Name…”

Let me know if fixes!

Best

Will

• Options

Hi @Will Jeffords!

It brought the #UNPARSEABLE error.

I changed it, I put it this way now =COUNTIF([Coded Name]:[Coded Name], LEFT(@cell, 2) =22)

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!