Skip to main content
Solved

Creating an IF statement for multiple options in a Field

  • February 8, 2023
  • 3 replies
  • 382 views

Forum|alt.badge.img+1

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)
)

Best answer by bruceconsulting

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

bruceconsulting
Forum|alt.badge.img+13
  • Inspiring
  • 56 replies
  • Answer
  • February 8, 2023

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

 

 


Forum|alt.badge.img+1
  • Author
  • New Participant
  • 1 reply
  • February 8, 2023

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

 

 


Thanks so much Jody.

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

Much appreciated.
J


airballer86
Forum|alt.badge.img+18
  • Known Participant
  • 48 replies
  • June 23, 2023

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