条件格式化文本框
Conditional Formatting a textbox
我正在使用 ReportBuilder
下面是根据单元格中的值更改背景颜色的表达式。我想向现有表达式添加一个新条件,以将文本框 22 中的 'N/A' 更改为浅绿色
=iif(isnothing(reportitems!Textbox22.value),Nothing, switch(reportitems!Textbox22.value >1 and reportitems!Textbox22.value <=50,"#fd6767",reportitems!Textbox22.value >=51 and reportitems!Textbox22.value <=79,"#f8d3a9",reportitems!Textbox22.value >=80 and reportitems!Textbox22.value <=100,"LightGreen",reportitems!Textbox22.value = 0, "#fd6767"))
这是设计图
这是单元格中的表达式,如果该单元格没有值,它会返回 "N/A"。
=iif(isnothing(lookup(Fields!StatID.value,Fields!statID.value,Fields!pass_rate.value,"Res2nd")),"N/A",lookup(Fields!StatID.value,Fields!statID.value,Fields!pass_rate.value,"Res2nd"))
这是输出
我试过下面的方法,但这会使所有单元格变白
=switch(reportitems!Textbox22.value >1 and reportitems!Textbox22.value <=50,"#fd6767",reportitems!Textbox22.value >=51 and reportitems!Textbox22.value <=79,"#f8d3a9",reportitems!Textbox22.value >=80 and reportitems!Textbox22.value <=100,"LightGreen",reportitems!Textbox22.value = 0, "#fd6767",reportitems!Textbox22.value = "N/A","LightGreen")
将你的表达修改为:
=iif(isnothing(reportitems!Textbox22.value),Nothing, switch(reportitems!Textbox22.value >1 and reportitems!Textbox22.value <=50,"#fd6767",reportitems!Textbox22.value >=51 and reportitems!Textbox22.value <=79,"#f8d3a9",reportitems!Textbox22.value >=80 and reportitems!Textbox22.value <=100,"LightGreen",reportitems!Textbox22.value = 0, "#fd6767",reportitems!Textbox22.value ="N/A","LightGreen"))
试试这个表达式:
=switch(reportitems!Textbox22.value >=0 and reportitems!Textbox22.value <=50,"#fd6767",reportitems!Textbox22.value >=51 and reportitems!Textbox22.value <= 79,"#f8d3a9",reportitems!Textbox22.value >=80 or reportitems!Textbox22.value = "N/A","LightGreen")
通过使用下面的
设法使这个最终工作
=iif(reportitems!Textbox22.value >=0 and reportitems!Textbox22.value <=50 ,"#f1b1b1",iif(reportitems!Textbox22.value >50 and reportitems!Textbox22.value <=79,"#f8d3a9","LightGreen"))
我正在使用 ReportBuilder
下面是根据单元格中的值更改背景颜色的表达式。我想向现有表达式添加一个新条件,以将文本框 22 中的 'N/A' 更改为浅绿色
=iif(isnothing(reportitems!Textbox22.value),Nothing, switch(reportitems!Textbox22.value >1 and reportitems!Textbox22.value <=50,"#fd6767",reportitems!Textbox22.value >=51 and reportitems!Textbox22.value <=79,"#f8d3a9",reportitems!Textbox22.value >=80 and reportitems!Textbox22.value <=100,"LightGreen",reportitems!Textbox22.value = 0, "#fd6767"))
这是设计图
这是单元格中的表达式,如果该单元格没有值,它会返回 "N/A"。
=iif(isnothing(lookup(Fields!StatID.value,Fields!statID.value,Fields!pass_rate.value,"Res2nd")),"N/A",lookup(Fields!StatID.value,Fields!statID.value,Fields!pass_rate.value,"Res2nd"))
这是输出
我试过下面的方法,但这会使所有单元格变白
=switch(reportitems!Textbox22.value >1 and reportitems!Textbox22.value <=50,"#fd6767",reportitems!Textbox22.value >=51 and reportitems!Textbox22.value <=79,"#f8d3a9",reportitems!Textbox22.value >=80 and reportitems!Textbox22.value <=100,"LightGreen",reportitems!Textbox22.value = 0, "#fd6767",reportitems!Textbox22.value = "N/A","LightGreen")
将你的表达修改为:
=iif(isnothing(reportitems!Textbox22.value),Nothing, switch(reportitems!Textbox22.value >1 and reportitems!Textbox22.value <=50,"#fd6767",reportitems!Textbox22.value >=51 and reportitems!Textbox22.value <=79,"#f8d3a9",reportitems!Textbox22.value >=80 and reportitems!Textbox22.value <=100,"LightGreen",reportitems!Textbox22.value = 0, "#fd6767",reportitems!Textbox22.value ="N/A","LightGreen"))
试试这个表达式:
=switch(reportitems!Textbox22.value >=0 and reportitems!Textbox22.value <=50,"#fd6767",reportitems!Textbox22.value >=51 and reportitems!Textbox22.value <= 79,"#f8d3a9",reportitems!Textbox22.value >=80 or reportitems!Textbox22.value = "N/A","LightGreen")
通过使用下面的
设法使这个最终工作=iif(reportitems!Textbox22.value >=0 and reportitems!Textbox22.value <=50 ,"#f1b1b1",iif(reportitems!Textbox22.value >50 and reportitems!Textbox22.value <=79,"#f8d3a9","LightGreen"))