View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rick Rothstein \(MVP - VB\)[_647_] Rick Rothstein \(MVP - VB\)[_647_] is offline
external usenet poster
 
Posts: 1
Default Finding 1 of 3 different strings in a string

I doubt if anyone would call this "elegant", but it should do what you
want...

=IF(LEFT(A1,5)="Error",CHOOSE(MATCH(MID(A1,7,4),{" 4.4.","500:","code"},0),SUM(I$1:I$3),SUM(J$1:J$3), SUM(K$1:K$3)),"")

Note the absolute cell addresses used in the example formulas being executed
inside the CHOOSE function in response to your 3 error code messages...
these may be necessary when you copy the above formula down to protect their
referenced ranges... just something for you to keep in mind.

Rick


"MarkMcG" wrote in message
...

I have various text strings in a column called Errors:

Error 4.4.5, too many people
Error 500: you aren't allowed to do that
Error code is in the code

I need a single formula to evaluate which of the 3 strings I am working
with
to pull information out of the string. Find() will tell me if "4.4.5"
exists
in string1, but returns #VALUE for string2 and string3. I don't want to
get
have to read errors. It would nice if Find() returned 0 if the string was
not found.

Here is what I would like:

If(String1(), dostring1, If(String2(), dostring2, dostring3))

Is there an elegant way to do this without a UDF?