# Using IF Statement in datasets

**URL:** <https://community.hubspot.com/t/using-if-statement-in-datasets/54676>\
**Category:** APIs & Integrations\
**Created:** [April 8, 2022, 3:02pm UTC](https://community.hubspot.com/t/using-if-statement-in-datasets/54676 "2022-04-08T15:02:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![CD81](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cd81/32/50779_2.png) [@CD81](https://community.hubspot.com/u/CD81)\
**Post date:** [April 8, 2022, 3:02pm UTC](https://community.hubspot.com/t/using-if-statement-in-datasets/54676/1 "2022-04-08T15:02:05Z")

</div>

Hi, This is not strictly related to API/integration but support suggested posting under developers…

i’m hoping to use an IF statement in a dataset formula to identify when particular multi-select properties were chosen.

I’m getting a syntax error referring me the support documentation, but i cant find any info relating to multi-select fields - my query is essentially If ([event] = BIOMUK 2022, ‘true’, ‘false’) In this case BIOMUK 2022 is a selectable option within the multi-select ‘event’ field. I’ve tried ‘=’, is, LIKE and other operators but no luck. Am i missing something obvious/is there a way to phrase the formula that would work?

---

<div class="post-metadata">

**Author:** ![hipya](https://avatars.discourse-cdn.com/v4/letter/h/b2d939/32.png) [@hipya](https://community.hubspot.com/u/hipya)\
**Post date:** [April 8, 2022, 3:48pm UTC](https://community.hubspot.com/t/using-if-statement-in-datasets/54676/2 "2022-04-08T15:48:27Z")

</div>

Hi, I don’t know if this is what you are looking for but maybe it is.

I a single line:

`{{ "BIOMUK 2022" if ("BIOMUK 2022" in module.events) is truthy else "No BIOMUK 2022" }} `

Or with a normal if/else statement:

```lia-code-sample
{% if "BIOMUK 2022" in module.events %}
 BIOMUK 2022
{% else %}
 No BIOMUK 2022
{% endif %}

```

---

<div class="post-metadata">

**Author:** ![CD81](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cd81/32/50779_2.png) [@CD81](https://community.hubspot.com/u/CD81)\
**Post date:** [April 11, 2022, 8:06am UTC](https://community.hubspot.com/t/using-if-statement-in-datasets/54676/3 "2022-04-11T08:06:10Z")

</div>

Thanks for the suggestion. I was trying to have the formula work at the report-datasets level and i’m not sure that yet supports the syntax above, I think i’ll have to work on external report for now.

---

<div class="post-metadata">

**Author:** ![Ryamak](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ryamak/32/84335_2.png) [@Ryamak](https://community.hubspot.com/u/Ryamak)\
**Post date:** [January 9, 2024, 3:32pm UTC](https://community.hubspot.com/t/using-if-statement-in-datasets/54676/4 "2024-01-09T15:32:26Z")

</div>

Hello,

You might need to add CONTAINS to the formula? I was having the same issue with a multi-checkbox field and a HS Product rep sent me this formula to use.

IF(CONTAINS([DEAL.multi\_attribution\_lead\_department], “Marketing”) = true, 1, 0)  
Hope this helps!
