you can use the use a formula option in conditional formatting then put
=LEN(A1)>22 however it will not change while you are typing only after you exit the cell