MrExcel Publishing
Your One Stop for Excel Tips & Solutions


Posted by Susan on February 05, 2002 2:52 PM

=IF(C17="**Y","ST"," ")

Can someone please help me? This would seem to be relatively simple but I obviously can't get this to work right. I am using the formula above to insert ST if cell C17 equals any 3 character text code ending with Y by using * as the wildcard. However, it is not reading the asterick as a wildcard and only inserts ST if the cell contains exactly **Y and not CHY or GVY. Any suggestions? Thanks.

Posted by faster on February 05, 2002 2:57 PM

I hope this helps.

if you just need to check the right character for "Y"
=IF(RIGHT(C17,1)="Y","ST"," ")

if you are testing for "Y" and length of 3

=IF(AND(RIGHT(C17,1)="Y",LEN(C17)=3),"ST"," ")

Posted by Susan on February 05, 2002 3:04 PM

The second formula is what I wanted and works perfectly. Thanks for your help and fast response.