View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default find certain text and display it

"natek1234" wrote
Actually I found my problem but dont really know how to correct it. I
was looking for "ENT" and it displays this when "statement" is in the
cell even though i used "FIND" and "ENT" by itself is before statement
in the cell.


Think you meant the upper case "STATEMENT"

Is there a way i can correct this so it searchs from left to right
and stops once it finds it or something else i need to do?


The search is already from left to right.

One way which may suffice here is to use a leading space for "ENT",
ie input it to search for string: <spaceENT
within the reference search list in E2:E6
instead of just: ENT

This will avoid it picking up STATEMENT
and you could just use TRIM on the return in col B

Also, when it doesnt find a match it displays "NA" is there a way
i can keep it blank if it doesnt find anything?


Yes, of course. Just add a front error trap: IF(ISNA(MATCH...),"",

With the error trap and TRIM bolted on,
try instead in B2, array-entered:
=IF(ISNA(MATCH(TRUE,ISNUMBER(FIND(E$2:E$6,A6)),0)) ,"",TRIM(INDEX(E$2:E$6,MATCH(TRUE,ISNUMBER(FIND(E$ 2:E$6,A6)),0))))
Copy B2 down as far as required
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---