简体   繁体   English

条件格式公式/vba

[英]Conditional formatting formula/vba

I have the following table where people are in either group 1 or 2 or 3.我有下表,其中人们属于第 1 组或第 2 组或第 3 组。

在此处输入图片说明

What I want is to format (highlight) x differently when one person is in more than one group on one day.我想要的是当一天一个人在多个组中时以不同的方式格式化(突出显示)x。 Is there any possibility to do this neatly without vba based on formulae only?没有仅基于公式的 vba,是否有可能巧妙地做到这一点? If vba I do not have a nice idea how to approach this without simply browsing the entire table.如果 vba 我不知道如何在不浏览整个表格的情况下解决这个问题。 How should I approach that?我应该如何处理?

To achieve this with the help of the conditional formatting, follow these steps...要在条件格式的帮助下实现这一点,请按照以下步骤操作...

  1. Select the whole columns B:C.选择整列 B:C。
  2. Home --> Conditional Formatting --> New Rule --> Use a formula to determine which cells to format --> in the box below "Format values where this formula is true", paste the formula given below主页 --> 条件格式 --> 新规则 --> 使用公式来确定要设置格式的单元格 --> 在“设置此公式为真的值的格式”下方的框中,粘贴下面给出的公式
  3. Click on Format --> Font --> Choose the Bold italic and set the font color to red or as per your choice --> OK --> OK to finish.单击格式 --> 字体 --> 选择粗斜体并将字体颜色设置为红色或根据您的选择 --> 确定 --> 确定完成。

Formula for conditional formatting:条件格式的公式:

=AND(B1="x",COUNTIFS($A:$A,$A1,B:B,"x")>1)

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

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