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.

Mode() custom function

Featured Replies

Here's a pair of custom functions to return the mode for a list of numbers. Example:

Given:

4

2

3

2

5

Returns: 2

This function requires the list to be in sorted order. I used Jeremy Bante's QuickSort() CF to do this.

Mode ( list ) =


//Mode ( list )

//Given a list of numbers, returns the value(s) that occur most often.

//7-25-2005

//By Mike Hackett

Let (

[

bimodalSeparator = ", "; //how you want tied values to be separated

valueCount = ValueCount( list );

sortedList = QuickSort ( list ); //sorts the values

resultList = LeftValues( sortedList; 1 ); //keeps track of the values that occur most ofter

resultCount = 1; //occurrence count for the listed results

currentValue = LeftValues (sortedList; 1); //current value being checked

currentCount = 1; //occurrence count for current value

result = Substitute (

ModeSub ( RightValues(sortedList; valueCount -1) ; "" ; 0; currentValue ; currentCount ); //initial call to recursive sub function

Mode.fp7.zip

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.