I am wondering does the search function support order of precedence? I need the search function to break execution once the first criteria is met.
What my formula does
Search Laptops!D2 for certain keywords, once found print the text to the left and cut out the rest.
What I thought would happen
Excel finds B820 in Laptops!D2 prints the text to the left and chops the rest
What is actually happening
Excel finds B820 and Windows in Laptops!D2, prints the text to the left of Windows and not B820
My Formula
=IFERROR(LEFT(Laptops!D2,LOOKUP(2^15,SEARCH(D1:D7,Laptops!D2))-1),"")
I have tried quoting my required Search parameters as follows
=IFERROR(LEFT(Laptops!D2,LOOKUP(2^15,SEARCH({"B820","AMD","Pentium","Celeron","Windows","Intel","i3"},Laptops!D2))-1),"")
It gives the same result as when I reference them from D1:D7 which isn’t too surprising.
This is a point I made in your previous question – the formula was designed to cope with a single keyword in each cell – if there are multiple keywords what do you want to happen?
With the formula you quote you will get everything to the left of the last match in D1:D7, so if “Windows” and “B820” appear it will always get everything to the left of “Windows” if that’s listed later in D1:D7. You can switch the order in D1:D7 to suit or use the other formula I suggested, i.e.
=IFERROR(LEFT(Laptops!D2,AGGREGATE(15,6,SEARCH(D$1:D$7,Laptops!D2),1)-1),"")That version will always give you everything to the left of the first match in Laptops!D2
Does that help – if not can you give some examples where the formulas don’t work and what you want to get.