简体   繁体   English

有条件地根据列中的值格式化一个单元格

[英]Conditionally format one cell based on values in a column

The user enters a date/time into cell B2. 用户在单元格B2中输入日期/时间。 If this matches one of the values in column LI would like to format cell B2 as red, else format cell B2 as green. 如果匹配列中的一个值,则LI希望将单元格B2格式化为红色,否则将单元格B2格式化为绿色。

在此输入图像描述

Any idea how to do this? 知道怎么做吗?

Please format B2 green with standard fill, then apply the following Use a formula to determine which cells to format , Format values where this formula is true: 请使用标准填充格式化B2绿色,然后应用以下内容使用公式确定要格式化的单元格格式化此公式为真的值:

=match(B2,L:L,0)>0  

with formatting (red) to suit and Applies to B2. 格式化(红色)以适应和适用于B2。

Assuming you are using Excel 2007 onwards: 假设您使用的是Excel 2007以上版本:

  1. Set cell shading for B2 = Green 设置B2 =绿色的单元格着色
  2. Select Cell B2 and select the Conditional Formatting > New Rule menu item 选择Cell B2并选择Conditional Formatting > New Rule菜单项
  3. Use a formula to determine which cells to format
  4. In the formula bar, put in =ISNUMBER(MATCH(B2,$L$6:$L$100,0)) 在公式栏中,输入=ISNUMBER(MATCH(B2,$L$6:$L$100,0))
  5. For format, change shading to Red 对于格式,将阴影更改为红色

Obviously change the $L$6:$L$100 to suit you, but that should do it... 显然改变$L$6:$L$100以适合你,但是应该这样做......

What about breaking this up into two steps. 如何将其分为两步。

Try putting a simple formula in Cell B1 : 尝试在Cell B1一个简单的公式:

=ISNUMBER(MATCH(B2, L:L, 0))

This will return a TRUE if there's a match and a FALSE if there is not a match. 如果匹配则返回TRUE如果不匹配则返回FALSE Then make two conditional rules based on Cell B1 . 然后根据Cell B1制作两个条件规则。

暂无
暂无

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

相关问题 是否可以基于另一个单元格中的值有条件地使用数据条格式化一个单元格? - Is it possible to conditionally format one cell with a databar based on a value in another cell? 使用VBA根据单元格格式(单元格背景颜色)有条件地选择Excel单元格值 - Use VBA to select Excel cell values conditionally based on cell format (cell background color) 如何根据每个单元格的值和固定单元格的值有条件地格式化VBA中的列? - How do I conditionally format a column in VBA based on each cell's value and a fixed cell's value? 根据单元格值的范围使用ColorScale格式化一个单元格 - Format One Cell with ColorScale Based on Range of Cell Values 根据第一个单元格有条件地对单元格进行格式化 - Format cells in row conditionally based on the first cell 宏可根据单元格内容有条件地格式化行 - Macro to Conditionally Format rows based on cell contents 如果单元格行包含“ z”,则有条件地格式化A列 - Conditionally format column A if cell row contains “z” VBA 如何根据该范围内一个单元格的值有条件地格式化一系列单元格? - VBA How do I conditionally format a range of cells based on the value of one cell in that range? 基于一个单元格中的多个条件在一列中求和的值 - Sum values in one column based on multiple conditions in one cell 如何根据第一个单元格是否为空来有条件地格式化 Excel VBA 中的一行? - How to conditionally format a row in Excel VBA based on if first cell is empty?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM