Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Juggernaut

Number of lines between two, in a list

Featured Replies

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

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):P

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

)

  • 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. :smile2:

LaRetta

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.