Linker IT Software
Google
Web www.oraxcel.com
menubar-top-links menubar-top-rechts
Home Help Search Login
Welcome, Guest. Please Login.
SQL*XL: Database to Excel bridge litLIB: Excel power functions pack ExcelLock: Locking and securing your valuable Excel spreadsheets encOffice: Protect your Excel file easy and safe encOffice: Protect your Excel file easy and safe
Pages: 1
litLIB: TextBetween usage (Read 1474 times)
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
litLIB: TextBetween usage
04.12.09 at 09:15:05
 
litLIB: TextBetween usage
 
Quote:

Using the WebPage function I retrieve the source of an HTML file.
A1: =WebPage("www.mysite.com")

I would like to extract some text from this web page starting at the second occurrence of the <li> tag. The copying should stop at the </li> tag. As you can see the function copies more. Why does it not stop at the </li> tag?

=TextBetween($A$1,"<li>","</li>",2,2)
Results in:
"10920&nbsp;-&nbsp;Hello World</li> <li>46380&nbsp;-&nbsp;Something else"

It should have stopped copying at </li>. Why does it continue?

 
You should have used: =TextBetween($A$1,"<li>","</li>",2,1)
 
Note that I have used a 1 as the last parameter. You want to stop after finding the first occurence of </li>. You used a 2 here. It will stop at the second occurrence of </li> after finding the search string. So the counting is performed after finding the search string (<li> in your case).
 
Back to top
 
 

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Pages: 1