Search code examples
excelexcel-formulacountoffice365unique

Excel - Count unique values that meets multiple criteria


I have 5 columns:

Quarter, Item, Type, Count, Date

I am trying to pull a UNIQUE count of date for each Quarter & Item combination ie. FY20Q3-AU has 2 different dates, FW20Q3-GLW has 1 unique date, FY20Q3-GLE also has only 1 unique date

Does anyone have any idea how I can accomplish this? I have been trying for a few hours modifying formulas that I found online without success.

If possible, I am trying to do this without an array formula (not sure if that is even possible)

I have tried:

{=SUM(--(FREQUENCY(IF(A:A=A2,MATCH(B:B,B:B,0)),ROW(B:B)-ROW(B2)+1)>0))}

| Quarter | Pricelist | Change Type | Item Count | Date    |
|---------|-----------|-------------|------------|---------|
| FY20Q3  | AU        | Type 1      | 1          | 4/18/20 |
| FY20Q3  | AU        | Type 1      | 1220       | 4/4/20  |
| FY20Q3  | CH        | Type 2      | 2          | 4/11/20 |
| FY20Q3  | CH        | Type 1      | 1378       | 4/4/20  |
| FY20Q3  | GLA       | Type 1      | 1          | 4/18/20 |
| FY20Q3  | GLA       | Type 1      | 1421       | 4/4/20  |
| FY20Q3  | GLB       | Type 1      | 1250       | 4/4/20  |
| FY20Q3  | GLB       | Type 2      | 1          | 4/4/20  |
| FY20Q3  | GLC       | Type 1      | 1          | 4/18/20 |
| FY20Q3  | GLC       | Type 1      | 1404       | 4/4/20  |
| FY20Q3  | GLH       | Type 2      | 2          | 4/11/20 |
| FY20Q3  | GLH       | Type 1      | 1387       | 4/4/20  |
| FY20Q3  | GLME      | Type 1      | 1          | 4/18/20 |
| FY20Q3  | GLME      | Type 1      | 1421       | 4/4/20  |
| FY20Q3  | GLEE      | Type 1      | 1          | 4/18/20 |
| FY20Q3  | GLEE      | Type 1      | 1227       | 4/4/20  |
| FY20Q3  | GLEU      | Type 1      | 1          | 4/18/20 |
| FY20Q3  | GLO       | Type 1      | 211        | 4/4/20  |
| FY20Q3  | GLK       | Type 1      | 1          | 4/18/20 |
| FY20Q3  | GLC       | Type 1      | 1          | 4/18/20 |
| FY20Q3  | GLW       | Type 1      | 1          | 4/18/20 |
| FY20Q3  | GLU       | Type 1      | 1          | 4/18/20 |
| FY20Q3  | GLZ       | Type 1      | 1          | 4/18/20 |
| FY20Q3  | JP        | Type 1      | 1          | 4/18/20 |
| FY20Q3  | NHI       | Type 1      | 1          | 4/18/20 |
| FY20Q3  | NHI       | Type 1      | 1          | 4/18/20 |
| FY20Q3  | WCH       | Type 2      | 2          | 4/11/20 |
| FY20Q3  | WCH       | Type 2      | 2          | 4/11/20 |

Solution

  • So since you got access to O365 and it's DA-functions you would not need a CSE entered formula nomore. You can utilize UNIQUE and FILTER. For example:

    =COUNTA(UNIQUE(FILTER(E:E,(A:A=A2)*(B:B=B2))))
    

    Where I would suggest you won't use whole column references to not break down performance too much.