ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   getting #value! when I figure I should be getting a diff value (https://www.excelbanter.com/excel-programming/273887-re-getting-value-when-i-figure-i-should-getting-diff-value.html)

Dave Peterson[_3_]

getting #value! when I figure I should be getting a diff value
 
if =search() doesn't find it, it doesn't return a 0, it returns an error
(#value).

So you could rewrite your formula to just look for errors in both searches. (If
there are two errors, then you want an F, else put a T.

=IF(AND(ISERROR(SEARCH("live",J1&N1&R1)),
ISERROR(SEARCH("appoint",J1&N1&R1))),"F","T")

(all one cell)

Another way is to just look to see if one (or both) of the searches returned a
number:

=IF(OR(ISNUMBER(SEARCH("live",J1&N1&R1)),
ISNUMBER(SEARCH("appoint",J1&N1&R1))),"T","F")

And another way to write this is:
=IF(OR(ISNUMBER(SEARCH({"live","appoint"},J1&N1&R1 ))),"T","F")

(Yeah, I'm too lazy to type concatenate (well, except in this sentence!).)

You may even want to change J1&n1&r1 to j1&"."&n1&"."r1 just in case the values
could be concatenated (ouch, that hurt) to form one of your words.


Bruccce wrote:

I have the following

=IF(SEARCH("live",CONCATENATE(J1,N1,R1))0,"T",IF( SEARCH("appoint",CONCATENA
TE(J1,N1,R1))0,"T","F"))

in one of my cells.

What I am trying to do is to determine if cells, J,N or R have either of the
following words "live" or "appointment".
Each section seem to work OK by themselves however, when I put the test for
the appoint in the "false" spot of the first if statement, I get a #value!
even if there is an appoint in one of the 3 cells.

What would be the best way to code this?
I would also like to NOT get the #value! at all, even if neither string is
found.

Thanks
Bruce


--

Dave Peterson



All times are GMT +1. The time now is 10:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com