简体   繁体   English

使用通用公式的Excel条件格式

[英]Excel conditional formatting using generic formula

I want to conditionally format cells in Excel. 我想有条件地格式化Excel中的单元格。 Is it possible to create a generic formula that does the following: 是否可以创建执行以下操作的通用公式:

IF the value in column A of the given row = "A" 
    AND the value in the given cell is greater than .1 
    AND the value in the given cell is less than 1
    THEN format the cell with a light grey background color

In the example below, I want the formula to apply to cells B1:K2, but I only want cells E1, I1 and K1 to be highlighted in grey. 在下面的示例中,我希望该公式适用于单元格B1:K2,但是我只希望单元格E1,I1和K1用灰色突出显示。

在此处输入图片说明

  • Select B1:K[n]. 选择B1:K [n]。 B1 is the active cell. B1是活动单元。
  • Then, click Home > Conditional Formatting > New Rule. 然后,单击主页>条件格式>新规则。
  • In the New Formatting Rule dialog box, click Use a formula to determine which cells to format. 在“新格式设置规则”对话框中,单击“使用公式来确定要格式化的单元格”。
  • Under Format values where this formula is true, type the formula: 在格式化该公式为真的值下,键入公式:

    =AND($A1="A",B1>0.1,B1<1) = AND($ A1 = “A”,B1> 0.1,B1 <1)

  • Click Format. 单击格式。

  • In the Fill box, select your light gray color. 在填充框中,选择您的浅灰色。
  • Click OK until the dialog boxes are closed. 单击确定,直到关闭对话框。

Greetings 问候

Axel 阿克塞尔

Select cells E1:F2,I1:I2,K1:K2 (hold down Ctrl while selecting discontinuous range) so the conditional formatting will apply to them. 选择单元格E1:F2,I1:I2,K1:K2 (在选择不连续范围时按住Ctrl ),以便对其应用条件格式。

The cell K1 should have the focus, ie be highlighted with white background, while other selected cells are highlighted with dark background. 单元格K1应该具有焦点,即用白色背景突出显示,而其他选定的单元格则用深色背景突出显示。 Insert conditional formatting with following formula: 使用以下公式插入条件格式:

=($A1="A")*(K1>0.1)*(K1<1)

Tap F5 and when the GoTo dialog opens, type A:K (◄ just like that) into the Reference: box and click OK. 点击F5 ,当“转到”对话框打开时,在“ 引用:”框中键入A:K(类似)。然后单击“确定”。 You should have columns A through K selected with A1 as the Active Cell . 您应该选择A到K列,并选择A1作为Active Cell

Create a new Conditional Formatting Rule using the Use a formula to determine which cells to format option and supply the following for Format values where this formula is true: 使用“ 使用公式来确定要格式化的单元格”选项创建一个新的条件格式设置规则在此公式为true的情况下为“ 格式”值提供以下内容

=AND($A1="A", A1>0.1, A1<1, ISODD(COLUMN(A:A)))

Click Format and select a light=grey Fill then click OK to accept the format and then OK again to create the new CF rule. 单击格式,然后选择浅=灰色填充,然后单击确定以接受格式,然后再次单击确定以创建新的CF规则。 Your results should resemble the following. 您的结果应类似于以下内容。

在此处输入图片说明

Edit: Revised from literal interpretation to subjective interpretation 编辑:从原义解释修订为主观解释

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

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