Search code examples
google-sheetsuniquematching

Google Sheets: Counting X where Y from column of uniques


I have no idea how to do this. I could do this in other programs but no idea here.

https://docs.google.com/spreadsheets/d/1rXTCfG9wbFqPUtl9w8h4WcSolWEowxFk94O3nY6Ib30/

This is a list of characters in a game, matching accounts. Column B is the accountname. Column E is a rank the characters are given based on things. Column O is a list of unique accountnames. Objective is to populate Column P with a list of unique accountnames that are of rank Citizen. The logic is basically:

for( columnO )
{
if( columnO.columnE == "Citizen" )
 {
  columnP();
 }
}

Solution

  • =UNIQUE(FILTER(Sheet1!B3:B, Sheet1!E3:E = "Citizen"))

    Edit

    Changed formula based on comments from @Victor Sheckels

    The formula looks for all of the account names in column B that correspond to the rank "Citizen" in column E, and then uses UNIQUE() to return on only the unique values.

    enter image description here