Help

Upcoming database upgrades. to improve our reliability at 03:30 UTC on Feb. 25 / 7:30pm PT on Feb. 24. Some users may briefly experience slow load times or error messages. Learn more here

IF AND formula checkbox issue

Topic Labels: Formulas
Solved
Jump to Solution
463 3
cancel
Showing results for 
Search instead for 
Did you mean: 

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

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

See Solution in Thread

3 Replies 3

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 :slightly_smiling_face:

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