Skip to main content

Why does this AND function not work and a simplified version do?

  • May 21, 2024
  • 2 replies
  • 23 views

Forum|alt.badge.img+2

Hi there,

I dont understand the difference between 2 formulas :

 

IF( AND( {Startdatum Leverancier (rol repowered)} != BLANK(), {Einddatum leverancier (rol repowered)} = BLANK() ), "OT", IF( AND( {Startdatum Leverancier (rol repowered)} = BLANK(), {Einddatum leverancier (rol repowered)} = BLANK() ), "", "BT" ) )

 

This formula does  NOT work as intended and ALWAYS shows OT regardless of the 2 fields content (empty or filled). I need to add that these fields are date fields. 

 

IF( {Startdatum Leverancier (rol repowered)} = BLANK(), "", IF( {Einddatum leverancier (rol repowered)} = BLANK(), "OT", "BT" ) )

 

This one DOES work as intended. Although I fixed the issue my curiousity is getting the better of me what I did wrong in the first bit of code. Anybody ideas? 

2 replies

BillH
Forum|alt.badge.img+24
  • Brainy
  • May 21, 2024

see https://support.airtable.com/docs/identifying-blank-values#:~:text=The%20BLANK()%20function%20can,is%20used%20within%20IF%20statements.&text=When%20using%20BLANK()%20along,are%20selecting%20aren't%20numeric.

"Note

When using BLANK() along with != (not equal to), you may receive unexpected results if the fields you are selecting aren't numeric."


Alexey_Gusev
Forum|alt.badge.img+25

Hi.
Airtable formulas are quite flexible. You don't need to use BLANK. Statement 'if value X exists, show Z, otherwise show Y' will be IF(X,Z,Y)
You can even omit 'value if false', the default is 'show nothing' : if(X,Z)

therefore, you can do it in such way:

IF({Startdatum Leverancier (rol repowered)}, IF({Einddatum leverancier (rol repowered)},'BT','OT'))