Do I need a helper column, or can I do this with a formula?

Posted by dwwilson66 on Super User See other posts from Super User or by dwwilson66
Published on 2012-06-18T13:56:30Z Indexed on 2012/06/18 15:18 UTC
Read the original article Hit count: 212

I am using this formula

=IF((LEFT($B26,2)="<p"),0,IF($B26="",0,IF($F26<>"",0,(FIND("""../",$B26)))))

To parse data similar to the following.

<nobr>&nbsp;&nbsp;&nbsp;&nbsp;contractor information</nobr><br> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="../City_Electrical_Inspectors.htm"><b> City Electrical Inspectors</b></a><br>
<nobr>&nbsp;&nbsp;&nbsp;&nbsp;<a href="../City_Electrical_Inspectors.htm"><b>inspection</b></a></nobr><br>

My problem comes in cases such as the first line, in which the line is not a new paragraph nor a link, and my FIND returns an error of #VALUE!

Id like to create an IF test to scan the line for the existence of the pattern in my FIND statement before processing that statement. I figured that looking for an error condition may be the way to go. However, the only way I can envision this is as a self-referential formula, similart to the following pseudocode.

IF(ISERROR($L26)=TRUE,$L26=0,L$26=the-result-of-the-formula-above)

Can this be done with a formula or do I need to use a new helper column?

Thanks.

© Super User or respective owner

Related posts about microsoft-excel

Related posts about worksheet-function