November 23, 200619 yr If I have a list (one text field), such as: Pigs Can Fly Pigs Don't [color:blue]Fly South For Winter [color:green]Pigs Fly North For Summer I want to specify two lines (in this case words) and find the number of lines between them. So, if I specify [color:green]Pigs then [color:blue]Fly, I want the result to be determined as: The last Pigs entry is at 10. The first Fly entry (BEFORE) the last Pigs is at 6. Difference is 4. So the first criteria is the LAST matching entry and the second criteria is the FIRST entry right before the first criteria (last Pigs). My result should be 3 (3 full lines between). I don't have a text field like this. I'm trying to understand how to numberize lists and determine the number of a line within the list in relation to a different line within the same list. I would also like to protect from false positives in case there is more than one word per line. I'm not using 8.5 yet so I haven't played with the List idea. I'd like to accomplish this in 8.0 but wouldn't mind knowing how 8.5 would handle it as well. LaRetta
November 23, 200619 yr The first Fly entry (BEFORE) the last Pigs is at 6. No, the FIRST "Fly" entry before the last "Pigs" is at 3. Assuming you mean the LAST "Fly" entry before the last "Pigs", you could try something like this (untested, no error checking) Let ( [ end = Position ( ¶ & text & ¶ ; "¶Pigs¶" ; Length ( text ) + 2 ; - 1 ) ; short = Left ( text ; end - 2 ) ; start = Position ( ¶ & short & ¶ ; "¶Fly¶" ; Length ( short ) + 2 ; - 1 ) ; mid = Middle ( text ; start ; end - start - 1 ) ] ; ValueCount ( mid ) - 1 )
November 26, 200619 yr Author That works perfectly! I see how you chopped the list using 'short' to grab the last of the first (fly); well actually the LAST fly (in the short). That was my main sticking point. This shows me how to break up lists!! Thanks for listening for my meaning and not just my words. This calc is very clear and the perfect example of extracting anything within ANY string if the parameters are properly specified. I will memorize this puppy. Very much appreciated, Michael. LaRetta
Create an account or sign in to comment