ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   IF() with #VALUE (https://www.excelbanter.com/excel-worksheet-functions/163968-if-value.html)

avgrin

IF() with #VALUE
 
IF(search(A1, B2)0,A,B)
I'm searching for a string in A1 in the cell B2, if B2 contains A1, search()
returns starting position of A1, and operation A is performed. However, when
it is not there, #VALUE is returned. How do I get operation B?
Thank you

Peo Sjoblom

IF() with #VALUE
 
=IF(ISNUMBER(SEARCH(A1,B2)),"A","B")

--


Regards,


Peo Sjoblom




"avgrin" wrote in message
...
IF(search(A1, B2)0,A,B)
I'm searching for a string in A1 in the cell B2, if B2 contains A1,
search()
returns starting position of A1, and operation A is performed. However,
when
it is not there, #VALUE is returned. How do I get operation B?
Thank you




Elkar

IF() with #VALUE
 
Try this:

=IF(ISNUMBER(SEARCH(A1,B2),A,B)

This way, if SEARCH returns a number (starting position), A is performed.
Anything else (like #VALUE!), B is performed.

HTH,
Elkar


"avgrin" wrote:

IF(search(A1, B2)0,A,B)
I'm searching for a string in A1 in the cell B2, if B2 contains A1, search()
returns starting position of A1, and operation A is performed. However, when
it is not there, #VALUE is returned. How do I get operation B?
Thank you


excelent

IF() with #VALUE
 
=IF(ISERROR(SEARCH(A1,B2));"B";"A")


"avgrin" skrev:

IF(search(A1, B2)0,A,B)
I'm searching for a string in A1 in the cell B2, if B2 contains A1, search()
returns starting position of A1, and operation A is performed. However, when
it is not there, #VALUE is returned. How do I get operation B?
Thank you


Ron Coderre

IF() with #VALUE
 
Perhaps something like this:
=IF(COUNTIF(B1,"*"&A1&"*"),expr_A,expr_B)

Is that something you can work with?
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)

"avgrin" wrote in message ...
IF(search(A1, B2)0,A,B)
I'm searching for a string in A1 in the cell B2, if B2 contains A1, search()
returns starting position of A1, and operation A is performed. However, when
it is not there, #VALUE is returned. How do I get operation B?
Thank you




excelent

IF() with #VALUE
 
ups

=IF(ISERROR(SEARCH(A1,B2)),"B","A")

"excelent" skrev:

=IF(ISERROR(SEARCH(A1,B2));"B";"A")


"avgrin" skrev:

IF(search(A1, B2)0,A,B)
I'm searching for a string in A1 in the cell B2, if B2 contains A1, search()
returns starting position of A1, and operation A is performed. However, when
it is not there, #VALUE is returned. How do I get operation B?
Thank you



All times are GMT +1. The time now is 06:57 PM.

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