# Creating an IF statement for multiple options in a Field

Topic Labels: Formulas
Solved
1519 3
cancel
Showing results for
Did you mean:
4 - Data Explorer

I'm new to coding so I'm a bit out of my depth.

I have a "Multiple Select" field and I'm trying to create a new field which counts how many selections were made for each record.

The items are given a rating depending on how many selections they can tick.

I have the below but I'm certain I'm making lots of very basic errors.
Any suggestions would be greatly appreciated.

{Sustainability Rating} = "n",

(("n" = 0)

IF({Sustainability Checklist}, "Is the item plastic free?", "n"+1),
IF({Sustainability Checklist}, "Is the item made from recycled material?", "n"+1),
IF({Sustainability Checklist}, "Is the item fully recyclable?", "n"+1)
)

1 Solution

Accepted Solutions
7 - App Architect

Hi,

You would think it would be an IF formula, but it's not.

Here's the formula you want:

IF({Sustainability Checklist},LEN({Sustainability Checklist})-LEN(SUBSTITUTE({Sustainability Checklist},",",""))+1)

If you want to talk about this further or if you ever need additional help, please schedule some time with me.  Here's my Calendly link:
https://calendly.com/d/ymz-t3t-fnp/30-minute-help-meeting

Jody

3 Replies 3
7 - App Architect

Hi,

You would think it would be an IF formula, but it's not.

Here's the formula you want:

IF({Sustainability Checklist},LEN({Sustainability Checklist})-LEN(SUBSTITUTE({Sustainability Checklist},",",""))+1)

If you want to talk about this further or if you ever need additional help, please schedule some time with me.  Here's my Calendly link:
https://calendly.com/d/ymz-t3t-fnp/30-minute-help-meeting

Jody

4 - Data Explorer

Thanks so much Jody.

I'll have a play with this tomorrow and let you know how I get on.

Much appreciated.
J

6 - Interface Innovator

Thank you @bruceconsulting for this solve! It's been driving me crazy!