具有多个条件的 IIf And 语句

IIf And statement with multiple conditions

我是 Access 的新手。 我想制作一个列,其中有两个条件导致“1”或“0”。

两个条件是:

If the session ID is smaller than 154 AND their level average is bigger than the current level, "1" is assigned, otherwise, "0".

If the session ID is equal to or bigger than 154 AND the exam average is more than 2, "1" is assigned, otherwise, "0".

我写的语法如下,但它不起作用 - returns 每个单元格都为 0。

IIf([Session_ID]<154 And [Level_Avg]>[Current_Lvl],"1","0") And IIf([Session_ID]>=154 And [Exam_Avg]>=2,"1","0")

谁能看一下?非常感谢任何意见。谢谢!

很可能您需要在两个条件之间使用 OR 运算符,因为任何一个都应该 return 1 选项,否则 return 0.

IIf(([Session_ID]<154 And [Level_Avg]>[Current_Lvl]) Or ([Session_ID]>=154 And [Exam_Avg]>=2), 1, 0)