how to nest two if functions

hxkresl

New Member
Joined
Dec 31, 2012
Messages
7
I'm building a formula, that will evaluate whether a cell contains a tilde, and then return the position of the tilde.

First, I identify if the cell contains a tilde. This works:
=IF(IF(ISERROR(FIND("~",B2)),"Not found", "Found")

Next, I'd like the position of the tilde returned to the cell.
SEARCH(b2,"~",1)

This is what I came up with, but getting #VALUE!:
=IF(IF(ISERROR(FIND("~",B2)),"Not found", "Found")="Found",SEARCH(B2,"~",1),"")
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
hxkresl,

How about:


Excel 2007
BC
2Find the ~ please.Found at 10
3Find the ? please.Not found
4
Sheet1
Cell Formulas
RangeFormula
C2=IF(ISERROR(FIND("~",B2,1)),"Not found","Found at " & FIND("~",B2,1))
C3=IF(ISERROR(FIND("~",B3,1)),"Not found","Found at " & FIND("~",B3,1))
 
Upvote 0
hxkresl,

Thanks for the feedback.

You are very welcome. Glad I could help.

Please come back anytime.
 
Upvote 0
If you happen to be using Excel 2007 or later, you could use the IFERROR function:

=IFERROR("Found at "&FIND("~",B2),"Not found")
 
Upvote 0
If you happen to be using Excel 2007 or later, you could use the IFERROR function:

=IFERROR("Found at "&FIND("~",B2),"Not found")

That's very nice too. I have to build on this however, to evaluate the length of the text minus the ~, and it's going in the following direction:
=IF(ISERROR(FIND("~",B2,1)),LEN(B2),LEN(B2)-1)
so I'm going to go with first one.

Thanks,
hxkresl
 
Upvote 0
=IF(ISERROR(FIND("~",B2,1)),LEN(B2),LEN(B2)-1)
I think you'll find this does the same thing without having to worry about errors at all.

=LEN(B2)-(FIND("~",B2&"~")<=LEN(B2))
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,196
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top