简体   繁体   English

基于多个单元格和值的Excel条件格式

[英]Excel conditional formating based on the multiple cells and values

I am trying to implement various conditional formatting to a specific data base. 我正在尝试对特定的数据库实施各种条件格式。 Looked for answer around here but can not find anything similar. 在这里寻找答案,但是找不到类似的答案。 Might not be possible but it is worth a try. 可能不可能,但值得尝试。
I am preforming various data cleansing and validation. 我正在执行各种数据清理和验证。
Here is the case: (small sample, working with 100k data entries in this particular file) 就是这种情况:(小样本,在此特定文件中使用100k数据条目)

在此处输入图片说明

Ultimately what I want is the formula that will compare the low-level Description characters after the last "UNDERSCORE" to the characters after last "UNDERSCORE" of the higher level(highlighted). 最终,我想要的公式是将最后一个“ UNDERSCORE”之后的低级描述字符与更高级别(突出显示)的最后一个“ UNDERSCORE”之后的字符进行比较。 If it does not match then highlight the cell? 如果不匹配,则突出显示单元格?

Asking for too much, yes, no, maybe? 要求太多,是,否,也许? I am open to any other suggestions on how can I perform various data cleaning and validation! 我对如何执行各种数据清理和验证有其他建议!

Thank you! 谢谢!

If you must use the last "UNDERSCORE" character, and can't depend on the suffixes being four characters, the formula becomes quite complex. 如果必须使用最后一个“ UNDERSCORE”字符,并且不能依赖于后缀是四个字符,则公式将变得非常复杂。 For simplicity's sake, I assumed the higher level is always missing the last five characters of the lower level, if you must go by the last "DASH" character, then this will be a lot longer. 为简单起见,我假设较高的级别始终缺少较低级别的最后五个字符,如果必须经过最后的“ DASH”字符,则该时间将更长。

Use this formula to highlight the cells, defining the two names LEVELS and DESCRS to be the two columns: 使用此公式突出显示单元格,将两个名称LEVELS和DESCRS定义为两列:

=IFNA(MID(B2,FIND("[]",SUBSTITUTE(B2,"_","[]",LEN(B2)-LEN(SUBSTITUTE(B2,"_",""))))+1,999)<>MID(INDEX(DESCRS,MATCH(LEFT(A2,LEN(A2)-5),LEVELS,0),1),FIND("[]",SUBSTITUTE(INDEX(DESCRS,MATCH(LEFT(A2,LEN(A2)-5),LEVELS,0),1),"_","[]",LEN(INDEX(DESCRS,MATCH(LEFT(A2,LEN(A2)-5),LEVELS,0),1))-LEN(SUBSTITUTE(INDEX(DESCRS,MATCH(LEFT(A2,LEN(A2)-5),LEVELS,0),1),"_",""))))+1,999),FALSE)

This uses a very nice trick with SUBSTITUTE to find the last occurrence of a character. 这与SUBSTITUTE一起使用了一个很好的技巧,可以找到字符的最后一次出现。

BTW, I would probably write a Perl program to parse the data and find errors. 顺便说一句,我可能会编写一个Perl程序来解析数据并查找错误。

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

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