List.Modes
ListReturns all values that appear with the highest frequency in the list (all modes when there is a tie).
Syntax
List.Modes(list as list, optional equationCriteria as any) as listParameters
| Name | Type | Required | Description |
|---|---|---|---|
list | list | Yes | The list to find all modes of. |
equationCriteria | any | No | An optional equation criteria to control how equality is determined. |
Return Value
list — A list of all values tied for the highest frequency.
Remarks
List.Modes returns a list of all values that share the maximum frequency in the input list. When there is only one most-frequent value, it returns a single-element list. When multiple values tie for the highest frequency, all tied values are returned.
This is the multi-value counterpart of List.Mode. Use List.Modes when you need to detect whether a dataset is multimodal (has ties) or when downstream logic must handle all equally common values. If you only need one mode and ties are not a concern, List.Mode returns a scalar directly, which is simpler to use.
The order of modes in the result follows their first appearance in the source list. Null values count as occurrences and can be included in the result. An empty list causes an error — guard with List.IsEmpty if needed. Comparison is case-sensitive for text by default; pass Comparer.OrdinalIgnoreCase as the optional equationCriteria argument for case-insensitive frequency grouping.
Examples
Example 3: Detect tied categories
let
Categories = {"A", "B", "A", "B", "C"},
AllModes = List.Modes(Categories)
in
AllModesThe final output — a list of all tied mode values from the Categories list.
Result | |
|---|---|
| 1 | {A, B} |