计算字段的嵌套 IIf 语句
nested IIf statement for calculated field
我在 Access 中有这个公式 table
iif([selling_unit_height]>[selling_unit_length],[selling_unit_height],[selling_unit_length],
iif([selling_unit_height]>[selling_unit_width],[selling_unit_height],[selling_unit_width],
iif([selling_unit_length]>[selling_unit_width],[selling_unit_length],[selling_unit_width])))
你能不能在 Access 中做这样的事情?我有三个数字,我想得到三个数字中最大的一个。它说参数数量错误。如果我不能这样做,那么我需要其他方法来帮助我。
查看此资源 https://support.office.com/en-us/article/IIf-Function-32436ecf-c629-48a3-9900-647539c764e3,或尝试搜索 "ms access iif"
您可以嵌套 "Iif",但语法错误。
iif(
[selling_unit_height]>[selling_unit_length], # Condition
[selling_unit_height], # true response
iif( # false response, a new iif
[selling_unit_height]>[selling_unit_width], # condition
[selling_unit_height], # true response
iif( # false response, a new iff
[selling_unit_length]>[selling_unit_width],# condition
[selling_unit_length], # true response
[selling_unit_width] # final false response
)
)
)
我并没有真正考虑你所追求的逻辑,而只是强调了语法错误。
我认为您需要一个公式,您可以将其用作数据类型为 Calculated 的字段的 Expression 属性 ]. (这意味着您的数据库是 ACCDB 类型并且您的 Access 版本是 >= 2010。)
我将其用作名为 largest ...
的字段的 Expression
IIf([h]>=[l] And [h]>=[w],[h],IIf([l]>=[h] And [l]>=[w],[l],IIf([w]>=[h] And [w]>=[l],[w],Null)))
它从这 3 个字段(h
、l
和 w
)中检索最大值,如果其中任何一个包含 Null,则检索 Null。
这是 table 的屏幕截图,其中包含示例数据...
我在 Access 中有这个公式 table
iif([selling_unit_height]>[selling_unit_length],[selling_unit_height],[selling_unit_length],
iif([selling_unit_height]>[selling_unit_width],[selling_unit_height],[selling_unit_width],
iif([selling_unit_length]>[selling_unit_width],[selling_unit_length],[selling_unit_width])))
你能不能在 Access 中做这样的事情?我有三个数字,我想得到三个数字中最大的一个。它说参数数量错误。如果我不能这样做,那么我需要其他方法来帮助我。
查看此资源 https://support.office.com/en-us/article/IIf-Function-32436ecf-c629-48a3-9900-647539c764e3,或尝试搜索 "ms access iif"
您可以嵌套 "Iif",但语法错误。
iif(
[selling_unit_height]>[selling_unit_length], # Condition
[selling_unit_height], # true response
iif( # false response, a new iif
[selling_unit_height]>[selling_unit_width], # condition
[selling_unit_height], # true response
iif( # false response, a new iff
[selling_unit_length]>[selling_unit_width],# condition
[selling_unit_length], # true response
[selling_unit_width] # final false response
)
)
)
我并没有真正考虑你所追求的逻辑,而只是强调了语法错误。
我认为您需要一个公式,您可以将其用作数据类型为 Calculated 的字段的 Expression 属性 ]. (这意味着您的数据库是 ACCDB 类型并且您的 Access 版本是 >= 2010。)
我将其用作名为 largest ...
的字段的 ExpressionIIf([h]>=[l] And [h]>=[w],[h],IIf([l]>=[h] And [l]>=[w],[l],IIf([w]>=[h] And [w]>=[l],[w],Null)))
它从这 3 个字段(h
、l
和 w
)中检索最大值,如果其中任何一个包含 Null,则检索 Null。
这是 table 的屏幕截图,其中包含示例数据...