Countif and HAS for multiselect for Quiz answers

I am using Countif and HAS to count a cell if a person has selected the correct quiz answers in a multiselect field.

=COUNTIF([Q2]@row, HAS("a", "b", "c", "e"))

This is returning 0 and I am not sure why?

Best Answers

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Answer ✓

    Are you trying to count how many times the cell has those letters in it, or are you trying to count a single cell if it contains at least one of them? At best you will only receive 1 or 0 if you are counting a single cell.

    thinkspi.com

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Answer ✓

    In that case you would have to incorporate an OR statement.

    =COUNTIFS([Q2]@row, OR(HAS(@cell, "A"), HAS(@cell, "B"), HAS(@cell, "C")))

    thinkspi.com

Answers

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Answer ✓

    Are you trying to count how many times the cell has those letters in it, or are you trying to count a single cell if it contains at least one of them? At best you will only receive 1 or 0 if you are counting a single cell.

    thinkspi.com

  • I'm trying to count a single cell if it has all of them checked. I'm getting a 0 even when they are all checked. These letters are options in the multiselect field.

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Answer ✓

    In that case you would have to incorporate an OR statement.

    =COUNTIFS([Q2]@row, OR(HAS(@cell, "A"), HAS(@cell, "B"), HAS(@cell, "C")))

    thinkspi.com