I want to count the number of select boxes, How can I Do?

Hi there :grinning:

I want to count the number of select boxes, How can I Do?

If MATH was checked, then Socore show 1
If MATH and HISTORY was checked, then Socore show 2
If MATH and HISTORY and ART was checked, then Socore show 3
If MATH and HISTORY and ART and MUSIC was checked, then Socore show 5

In Score’s column, I have tried↓

switchif(thisRow.[MATH].Not() Or thisRow.[HISTORY].Not() Or thisRow.[ART].Not() Or thisRow.[MUSIC].Not(),1,thisRow.[MATH].Not() And thisRow.[HISTORY].Not() And thisRow.[ART].Not() And thisRow.[MUSIC].Not(),5)

IF(Count(True(thisRow.[MATH],thisRow.[HISTORY],thisRow.[ART],thisRow.[MUSIC]))<4,Count(True(thisRow.[MATH],thisRow.[HISTORY],thisRow.[ART],thisRow.[MUSIC])),5)

But all of it was unwork…

If anyone has any experience in this regard, would be very interested to know your experience.

@11183

Here’s an approach you might be able to adapt to your use case:

That’s what I was going to suggest :yum:

List(thisRow.MATH,thisRow.HISTORY,thisRow.ART,thisRow.MUSIC).CountIf(CurrentValue=True())

Hi @11183,

You can add a column “Correct Answers” with the following formula:

List(thisRow.MATH,thisRow.HISTORY,thisRow.ART,thisRow.MUSIC).CountIf(CurrentValue)

(which is the same @Pch just posted, btw. Note that you can shortcut CurrentValue=True(), through CurrentValue alone, as it’s already a boolean)

And Score column will have:

If(thisRow.[Correct Answers]=4,5 ,thisRow.[Correct Answers])

Good catch @Federico_Stefanato :blush: .
I didn’t see the specific demand for 5 if everything was checked instead of 4 :wink:

I really need to write a post-it with this very good point and keep it on my screen :smirk: !
Thanks for pointing this out :grin: !

Its worked!!


Appreciate your helping!!

Thanks other user’s answer too!! Thankyou very much!!

2 Likes