IF AND formula checkbox issue

Hi,

I have issues with a checkbox that doesn’t work proper with my IF AND formula.

Or more correctly, when checkbox =“1” formula works fine, but when checkbox =“0” it doesn’t. As far as I can tell, an empty checkbox is supposed to be =“0”, right?

Formula looks like this:

IF(AND({Win}=‘Yes’, {EW}=“1”), (({Stake} / 2) * {Odds}) + (({Stake} / 2) * {EW Odds}), IF(AND({Win}=‘Yes’, {EW}=“0”), {Stake} * {Odds},
IF(AND({Win}=‘EP’, {EW}=“1”), {Stake} / 2 * {EW Odds}, {Stake} * 0)))

Works like a charm as long as the checkbox is marked, but when it’s not the 2nd Row of the formula is not working and instead the ELSE thing at the end of Row 3 kicks in.

I’m a total beginner at this so my apologies for novice language or stupid question.

Many thanks!

Best regards,
Marcus Sjöberg

I think the problem in your formulas is you put 1 or 0 in quotes. Remove the quotes and it should work.
See here: https://support.airtable.com/hc/en-us/articles/217113757-Using-checkbox-fields-in-formulas

Yes that made all the difference! Thank you so much for taking the time to help me out :slight_smile:

FWIW, you could also drop the 1 and 0 entirely. An undocumented feature of referencing fields in formulas is that using a field name alone will return True if the field contains anything, and False if it’s empty. Here’s your formula with that change applied:

IF(AND({Win}='Yes', {EW}), (({Stake} / 2) * {Odds}) + (({Stake} / 2) * {EW Odds}),
IF(AND({Win}='Yes', {EW}), {Stake} * {Odds},
IF(AND({Win}='EP', {EW}), {Stake} / 2 * {EW Odds}, {Stake} * 0)))

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.