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

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
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,215,440
Messages
6,124,882
Members
449,193
Latest member
PurplePlop

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