Forum Discussion

JackWoods's avatar
JackWoods
Qrew Trainee
4 years ago

Checkbox Formula to give me a 1 or a 0

Hey hey 

I was trying to figure out the formula so that when I check a checkbox (In another field) it will give me either a one or a zero in this formula field that I'm trying to build. I imagine it will look thing like...

If([Checkbox Field]="Checked",1,0)

This doesn't seem to work... error message is 

"the operator = can not be applied to types bool"

please advise how I can set this formula field up - Thank you!


------------------------------
Jack Woods
------------------------------
  • Try this

    If([Checkbox Field] = true,1,0)


    (as an aside, the opposite if true in this syntax would be false)


    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • JackWoods's avatar
      JackWoods
      Qrew Trainee
      I knew it was something silly. I was trying yes/no - checked/unchecked. everything else but True/False. thank you.

      ------------------------------
      Jack Woods
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend
        You could have also just done this

        If([Checkbox Field] ,1,0)

        That is because [Checkbox field] is a boolean which means it's either true or false.   So QB would evaluate the expression [Checkbox field] and it will either true or false on its own.  But I recognize that the formula reads a bit easier for humans the original way I posed.


        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        mark.shnier@gmail.com
        ------------------------------