Reference
No results for 'undefined'
    Powered by Algolia

    GROUP_BY

    Returns a grouped by specified key frame data.

    Syntax

    =GROUP_BY(inputFrame, groupingKey, groupingKey, ...)

    Parameters

    1. inputFrame
      • Type: Frame
      • Description: The data to be grouped.
    2. groupingKey [repeatable]
      • Type: Any
      • Description: A key to use as a grouping criteria.

    Returns

    • Type: Any
    • Description: Returns value or frame grouped by specified key

    Example

    =GROUP_BY(A1, "name")

    Extended example: using multiple keys

    Copy the source data below and paste it to a new spreadsheet:

    ABCD
    1 weight height age name
    21056foo
    31053bar
    415108baz
    515104oaf
    610126cool

    In A7 cell, group by "weight", then by "age"

    =GROUP_BY(FRAME(A1:D6), "weight", "age")

    or (equivalent):

    =GROUP_BY(FRAME(A1:D6), {"weight"; "age"})

    Open the result in nested frame view. Observe and open grouped data in "by_{name}" columns.

    Nested: grouped by "weight" column
    weight by_weight
    110
    Nested: data by "weight" = 10
    age by_age
    16
    Nested: data by "age" = 6
    weight height age name
    11056foo
    210126cool
    23
    Nested: data by "age" = 3
    weight height age name
    11053bar
    215
    Nested: data by "weight" = 15
    age by_age
    18
    Nested: data by "age" = 8
    weight height age name
    115108baz
    24
    Nested: data by "age" = 4
    weight height age name
    115104oaf

    Try It Now

    Sorry, your browser is not supported. MINTDATA™ works best on Google Chrome 50.0+ and Firefox 44.0+.

    Notes

    By default, the column with grouped items is named as "by_" prefix + key column name. The following syntax allows to modify column names while grouping:
    =GROUP_BY(A1, "key_column as my_name_for_key_column")
    Contents