IF function is used incorrectly...should have the same type.

Hi All, i need to automatically set the same values in multiple rows, but when I use this expression:

IF (AND([Ora Volo]<>”23:59”,[Volo]=[Volo],[Luogo]=[Luogo],OR(([Data]= TODAY()),([Data]=TODAY()+1))), [Ora Volo]=[Ora Volo], “23:59”)

I get this error: IF function is used incorrectly:the second input (value-if-true) and third input (value-if-false) should have the same type.

Can someone please help me?

The IF() expression when rearranged looks like below

IF (

AND([Ora Volo]<>”23:59”,[Volo]=[Volo],[Luogo]=[Luogo],OR(([Data]= TODAY()),([Data]=TODAY()+1))),

[Ora Volo]=[Ora Volo],

“23:59”

)

This means the IF() function will select [Ora Volo]=[Ora Volo] or “23:59” as one of the two results. However [Ora Volo]=[Ora Volo] will evaluate to a TRUE or FALSE result and other result is a textual value of “23:59”

The error is because of this mismatch of two expected results types.

IF() expects both the results of the same type, either TRUE/FALSE or text or date or duration or number and so on.

1 Like

Thank for your answer; now I realized my mistake

Thank you so much

1 Like

You are welcome.