Hello I am using the "LEFT" function to extract a piece of text from a cell that I then use as the lookup value in a Vlookup formula. Is there a function able count the text spaces in a cell so that i can use that info in conjunction with an IF formula to determine how many spaces I use the "left" formula?

this is the formula I am using now:

=VLOOKUP(LEFT(A8,5),'Violation Information'!$A$3:$C$114,3)

What I want i am trying to accomplish is below:

=if(A8=11 text spaces,VLOOKUP(LEFT(A8,5),'Violation Information'!$A$3:$C$114,3),VLOOKUP(LEFT(A8,6),'Violation Information'!$A$3:$C$114,3)

Thanks!