# IF AND formula checkbox issue

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

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

1 Solution

Accepted Solutions
6 - Interface Innovator

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

3 Replies 3
6 - Interface Innovator

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

4 - Data Explorer

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

18 - Pluto

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