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.

Finding Gaps in Sequence

Featured Replies

Someone requested on face book a function to find a gap in sequence.

 

Quote

I have a list of numbers such as 1¶2¶3¶6¶7¶8¶12¶13 I need to be able create a text string from this which looks like 1-3, 6-8, 12-13

This is my attempt for that with a While Function

If I were to add this to a custom function i would Replace X with a parameter - also perhaps suggest to do a unique list and sort list on the parameter.

 

While ( 

[ 
x = "1¶2¶3¶6¶7¶8¶12¶13¶16¶17¶18" ; 
y = "" ; 
z = "" ; 
out = "" ;
i = 1 ;
c = ValueCount ( x ) 

] ; 

i ≤ c  ; 

[ 

y = GetValue ( x ; i ) ;

z = case ( 

y+1 = GetValue ( x ; i+1 ) or  y-1 = GetValue ( x ; i+1 ) ; "" ;   "-" & y & "," ) ;

out =  Case ( i = 1 ; y ; Right (out ;1) = "," ; out & y ; out & z ) ; 

i = i+1

] ;
Case( right (out;1) = "," ; Left ( out ; Length (out) -1 ))
)

 

i haven't fully tested so please test it out before use in production - if you see room for improvement it is welcomed ;) 

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.