简体   繁体   English

Excel公式-有条件-如果字符数> 160,则突出显示单元格

[英]Excel Formula - Conditional - Highlight Cell if Char Count > 160

Apparently Stackoverflow does allow question on excel formulas, so I will give this a shot. 显然,Stackoverflow确实允许对excel公式提出疑问,因此我将对此进行介绍。 Hopefully I'm not down voted too quickly. 希望我不会很快被否决。

I'm creating an excel file, on one column I am expecting user input. 我正在创建一个excel文件,希望能在用户输入的一列上显示。 This column "should" have a max-char count of 160. I want this cell highlight if the user input is greater than this amount. 此列“应”的最大字符数为160。如果用户输入的字符数大于该数量,则我希望此单元格突出显示。

JS Pseudo Example: JS伪示例:

var x = $(this).val().length;

if(x>160){
 $(this).css("background","red");
}

Select the relevant column and HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true: : 选择相关列,然后选择“主页”>“样式-条件格式,新规则...”, 使用公式确定要格式化的单元格在此公式为true的情况下设置值的 格式 ::

=LEN(  

enter the reference to your mystery column 输入对您的神秘专栏的引用

1)>160

Format... , select colour Fill (highlight) of your choice, OK , OK . 格式... ,选择颜色填充(突出显示), 确定确定

However, as noted by @Scott Holtzman, where convenient it is generally better to block bad data than to accept and highlight it. 但是,正如@Scott Holtzman所指出的那样,通常在方便的情况下阻止不良数据胜于接受并突出显示它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM