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)

Answers

  • ahansen
    ahansen ✭✭
    Options

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

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

  • SoS | Dan Palenchar
    SoS | Dan Palenchar ✭✭✭✭✭✭
    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

    ▶️ Smartsheet Tutorial Videos: schoolofsheets.com/youtube

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

    If this helped, help me & the SSC by accepting it and reacting w/💡insightful, ⬆️ Vote Up, and/or ❤️Awesome.

    PS - If you have a follow up response attention use@Dan Palencharso I get notified of your reply!

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!