• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to find a 4-char. consecutive string in a cell?

Eloise T

Active Member
I am currently using the following formula to find a text string in a cell using the TRIM function to kill the spaces and the MID function to extract the string. I'm receiving the data containing the text string from many sources. Sometimes the submitters get sloppy and not only include unwanted spaces (the TRIM handily takes care of) but include other alphanumeric characters in front of (a problem) or behind (not a problem) the text string I'm wanting to isolate. Please see the attached file for clarification.

The formula: =IF(AND(H10=30,MID(TRIM(J10),1,3)="Tax"),30)
 

Attachments

@Whatever
1) TRIM works fine
2) MID works fine
but
You try to find where is string "Tax"
1) "TAX" <> "Tax" , "tax" <> "Tax" ONLY "Tax" = "Tax"
2) There are 'i' and '7%' before 'Tax', Your MID don't work.
test this: =IF(AND(H10=30;FIND("Tax";J10;1)>0);30)
 
@Whatever
1) TRIM works fine
2) MID works fine
but
You try to find where is string "Tax"
1) "TAX" <> "Tax" , "tax" <> "Tax" ONLY "Tax" = "Tax"
2) There are 'i' and '7%' before 'Tax', Your MID don't work.
test this: =IF(AND(H10=30;FIND("Tax";J10;1)>0);30)

Your formula works as long as "Tax" is case-sensitive.
My formula is not case-sensitive and works only as long as there is nothing in front of the string.
I need to grab a pencil and figure out how to merge the two so that it is not only case-sensitive but also allows leading alpha-numerics in the text ...just as long as "tax" is in consecutive order.
 
Hi:
If I understand correctly is this a much simpler formula.
Code:
=IF(AND(H10=30,SEARCH("*"&"tax"&"*",J10)>0),30,"")
Thanks
 
Whatever - Okay.
I'm waiting the results of Your test of compare (... time, space or ... ? )
with or without 'six characters' (actually more)?
You can select any of those formulas, with lets say 10,001 rows?
I would like to know also how many characters
did You use with both ways for formulas?
Thank You.
 
Back
Top