Help

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

Topic Labels: Formulas
357 2
cancel
Showing results for 
Search instead for 
Did you mean: 
sallierie
4 - Data Explorer
4 - Data Explorer

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 2

see https://support.airtable.com/docs/identifying-blank-values#:~:text=The%20BLANK()%20function%20can,is....

"Note

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

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