Can I create an if statement using two fields?

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
How do I create an if statement using two fields?

I have a [Days Since Last Call in] and a [Date Since Last Call In] field. 

If [Days_Since_Last_Callin] is <4, and [Date Since Last Call In] is not Null then I want to return a 1 in the formula field. If [Days_Since_Last_Call In]  is 4 or greater then I want to return a zero.

Currently I have this but cannot figure out how to add the null for date qualification. 


 If([Days_Since_Last_Callin] < 4, 1,0)
Photo of Dan

Dan

  • 0 Points

Posted 2 years ago

  • 0
  • 1
Photo of dwhawe

dwhawe, Champion

  • 744 Points 500 badge 2x thumb
Would this work:  If([Days_Since_Last_Callin] > 3.9, 0,1)
Photo of Dan

Dan

  • 0 Points
My current one above works, however I need to incorporate the second condition of If [Date Since Last Call In]  is Null, then 0.
Photo of dwhawe

dwhawe, Champion

  • 744 Points 500 badge 2x thumb
Try this:



If(IsNull([Days_Since_Last_Call in]),0,

[Days_Since_Last_Call in] < 4, 1,

0)

QuickBase will stop when it has a positive test so a Null value will return a 0 and stop.  If not null it will go on to test number of days
Photo of Dan

Dan

  • 0 Points
Worked perfectly. It may have been confusing when I wrote the field names in the question, but I followed your guidance and the below is the final result. Thanks!

If(IsNull([Date_Last_Call_in]),0,
 [Days_Since_Last_Callin] < 4, 1,
0)
Photo of dwhawe

dwhawe, Champion

  • 744 Points 500 badge 2x thumb
I'm glad you got it working.  I see where I used Days field where it was your Date field.  Copy/Paste can be a problem like that when not paying enough attention