Search code examples
excelexcel-formula

Count of Unique Values based on who it's assigned to?


I have a table of landowners, agents assigned to them, and the status of project. enter image description here

In column F, I want a unique count of how many unique landowners are assigned to each agent (column E) based on the value "Outreach" in column C.

The picture is expected output based on this formula, but it's not working when I type in the formula?

=COUNTA(UNIQUE(A:A,COUNTIFS(B:B=E2,C:C="Outreach")))

Any ideas?


Solution

  • If I understood correctly your goal, you want to group the range by two fields.

    =COUNTA(UNIQUE(FILTER(A2:A10,(B2:B10="Mike")*(C2:C10="Outreach"))))

    You can combine this with UNIQUE(B2:B10) to generate a list of agents.

    This is a very temporary solution as of this time. The beta channel in Excel just released a new function GROUPBY(). Once it goes to main channel, you would be able to do what you want just by using it.

    see https://insider.microsoft365.com/en-us/blog/new-aggregation-functions-in-excel-groupby-and-pivotby

    UPD 2025-02-10 Per request, this is possible solution for GROUPBY()

    =GROUPBY(B1:B10,C1:C10,COUNTA,3,0,1,C2:C10="Outreach")

    COUNTA should be used for strings, COUNT will only work on values.

    see syntax at https://support.microsoft.com/en-us/office/groupby-function-5e08ae8c-6800-4b72-b623-c41773611505