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