Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Search Function with exact string without spaces

I am trying to write a Excel function that filters an array based on the text of one column. I have everything working as intended except when I search for MOVE as opposed to REMOVE. I want the "Move" search to only return rows with "move" and not "remove"

I have seen other examples that include spaces but my cells do not have spaces so I cannot use this trick.

This is a simplified example of what I am trying to do. I would like this formula to only display ORANGE and not display APPLE.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Data:  
APPLE REMOVE  
ORANGE MOVE  

Formula:

=FILTER(A:B,ISNUMBER(SEARCH("MOVE",B:B)),"")

Results:  
APPLE REMOVE  
ORANGE MOVE

Desired Results:  
ORANGE MOVE

>Solution :

Try using the following formula by adding an empty string beside the conditions:

enter image description here


• Formula used in cell C1

=FILTER(A1:B2,1-ISERR(FIND(" MOVE "," "&B1:B2&" ")))

Also I would suggest you to use Structured References aka Tables instead of using the whole ranges in your formula, honestly it slows down the working capacity of Excel, since you will be iterating the functions to perform the task for blank rows as well. Which is why it is always asked to avoid.

enter image description here


=FILTER(Fruits,1-ISERR(FIND(" MOVE "," "&Fruits[Header 2]&" ")))

In place of 1-ISERR( you can also use ISNUMBER()

=FILTER(Fruits,ISNUMBER(FIND(" MOVE "," "&Fruits[Header 2]&" ")))

One more alternative method using TEXTBEFORE()

enter image description here


=FILTER(Fruits,TEXTBEFORE(Fruits[Header 2],"MOVE")="")

Precisely to show more clarity in my answer:

enter image description here


Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading