How can I use COUNTIFS with DISTINCT?

Options
✭✭

I'm trying to count all the distinct records in one column where specific criteria is met in another column.

I can write the formulas separately, but I'm unsure how to combine them since COUNTIFS requires <range>,<criteria>.

=COUNT(DISTINCT({Identifier}))

=COUNTIF({Round}, 2)

• ✭✭
Options

I think I figured this out using COLLECT. This seems to work:

=COUNT(DISTINCT(COLLECT({Identifier}, {Round}, Round@row)))

• ✭✭✭✭✭✭
Options

Hello @ahansen -

If you're able to share a screenshot of your Sheet and/or elaborate more that would help to help you.

A way you can do this is by using one or more helper column(s) that are used to identify if the criteria you are looking for is met. So one column could check if your Record is a unique name, another could check that your second criterion is met, and then a final column could check to see if both of these criteria are met. This final column could be summed to get the total number of unique Records that have additional criteria satisfied.

In the screenshot below I am using the Sheet Summary field Count to count all of the rows where Records is a unique value (based on Unique Record being checked) AND where Second Criteria is checked. When both of these are true the formula in Distinct + 2nd Criteria gets starred and the Count field counts all of rows where this is starred.

For visual cues, all of the counted rows are shaded green and the rows where the Record is unique but the Second Criteria is not checked is highlighted yellow.

The formulas I'm using are:

1. In Records: =IF(COUNTIF(Records:Records, Records@row) = 1, 1, 0)
2. In Distinct + 2nd Criteria: =IF(AND([Unique Record]@row = 1, [Second Criteria]@row = 1), 1)
3. In Count (Sheet Summary): =COUNTIF([Distinct + 2nd Criteria]:[Distinct + 2nd Criteria], 1)

Note that determine if a Record is distinct I am using an IF(COUNTIF()) formula rather than DISTINCT().

_____________________________________________________________________________________________

👨🏼‍💻 Dan Palenchar | School of Sheets Solutions Consulting | Smartsheet Aligned Gold Partner

If this response helped you please help me & the community by accepting it and reacting as you see fit (💡insightful, ⬆️ Vote Up, and/or ❤️Awesome).

🆘 Smartsheet Consulting Inquiries: schoolofsheets.com/workwithus