cancel
Showing results for
Did you mean:
Highlighted
Regular Visitor

## Counting how many yes in a radio button.

Hi ,

I have a app I am building. In this app it ask's about 15 questions with radio buttons that have a yes or no answer. I need to write a if statement  that counts how many yes's there are and if it more than 2 it changes the screen color.  With the help from user @mdevaney  I implemented the following code.

Un fortunately no mater how many yes's or no's are selected it always stays green. I'm not sure what i have done wrong. any help would be greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III

## Re: Counting how many yes in a radio button.

You might consider the following formula as a replacement:

If(
CountRows(
Filter(
Split(
";"
),
Result="Yes"
)
) > 1, Green,
Red
)

I noticed that you had what appeared to be the opposite logic on the Radio1_26 control.  Not sure the significance of that.

But, if you want to count the Yes's, the above formula should do it.

If you need a weighted system of counting then I like @mdevaney's formula for the assignment of numeric values.

I also assume that your Radio control Items property has an "OptionText" field in it.

Avoid using the SelectedText property of the controls that have them as they have been deprecated.

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
2 REPLIES 2
Highlighted
Super User III

## Re: Counting how many yes in a radio button.

You might consider the following formula as a replacement:

If(
CountRows(
Filter(
Split(
";"
),
Result="Yes"
)
) > 1, Green,
Red
)

I noticed that you had what appeared to be the opposite logic on the Radio1_26 control.  Not sure the significance of that.

But, if you want to count the Yes's, the above formula should do it.

If you need a weighted system of counting then I like @mdevaney's formula for the assignment of numeric values.

I also assume that your Radio control Items property has an "OptionText" field in it.

Avoid using the SelectedText property of the controls that have them as they have been deprecated.

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
Regular Visitor

## Re: Counting how many yes in a radio button.

Thanks, once I changed to selected instead of selectedtext it worked.

Announcements

#### Power Platform Community Conference

Check out the on demand sessions that are available now!

#### Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

#### Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

#### Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,094)