Search code examples
google-appsheet

Count how many instances the value in a column appears in that column


I need to create a virtual column in APPSHEET that will return a count of how many times the value in [ptnum] appears in the data table column [ptnum]. I want it to return the number as value in the virtual column. I need an APP Formula example

ptnum virtual_column
123 3
123 3
222 1
123 3

Solution

  • This formula counts all entries where ptnum is equal to this rows ptnum:

    COUNT(
     SELECT(
      TABLE[ptnum],
      [ptnum] = [_THISROW].[ptnum]
     )
    )