Excel 2007具有2个条件的条件格式,一个基于另一个列 [英] Excel 2007 Conditional formatting with 2 conditions, one based off another column

查看:523
本文介绍了Excel 2007具有2个条件的条件格式,一个基于另一个列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Excel 2007中使用了一个表。我试图突出显示一个列中的单元格,其中一个格式的值和它的状态(在另一列中)。

I'm using a table in Excel 2007. I'm trying to highlight cells in one column based off of its value and its status (which is in another column) in one format.

例如,我试图突出显示所有单元格(只有单元格,而不是行),毛利润为负,状态为IN。这样做的正确方法是什么?我试过if语句,但没有太大的成功。我不知道如何将两个条件应用于细胞。我需要选择单元格的列或范围吗?或者我必须选择第一个单元格并复制格式?

For example, I'm trying to highlight all cells (only the cells, not the row) with gross profits that are negative and have a status of "IN". What is the correct way to do this? I've tried if statements, but did not have much success. And I am not sure how to apply two conditions to the cells. Would I need to select the column or range of cells? Or would I have to select the first cell and copy the format?

谢谢,


示例:

状态毛利

1 IN $ 24.00

2 OUT $(34.00)

3 OUT $ 12.00

4 IN $ 18.00

5 IN $(9.00)

6 IN $(40.00)

7 OUT $ 32.00

8 OUT $ 45.00

9 OUT $ 23.00

10 IN $ 43.00

11 OUT $(18.00)

12 IN $ 7.00

13 IN $(25.00)

Item # Status Gross Profit 1 IN $24.00 2 OUT $(34.00) 3 OUT $12.00 4 IN $18.00 5 IN $(9.00) 6 IN $(40.00) 7 OUT $32.00 8 OUT $45.00 9 OUT $23.00 10 IN $43.00 11 OUT $(18.00) 12 IN $7.00 13 IN $(25.00)


推荐答案

这在Excel 2010中有效:

This works in Excel 2010:

我假设要突出显示的单元格在列C ...

I'm assuming the cells you want to highlight are in column C...


  • 突出列C中的所有单元格

  • 单击条件格式 - >突出显示单元格规则 - >更多规则

  • 为公式选择使用公式...

  • ,输入:
    = AND(C2 <0,$ b2 =IN)

  • 点击格式按钮,选择所需的突出显示颜色

  • 单击确定

  • highlight all cells in column C
  • Click Conditional Formatting->Highlight Cells Rules->More Rules
  • Choose "use a formula..."
  • for the formula, enter : =AND(C2<0, $b2="IN")
  • Click the "format" button and choose the highlight color of your choice
  • Click OK

尽管您已经根据最上面的单元格定义了公式,但Excel会将其整合到整列。

Although you've defined the formula in terms of the topmost cell, Excel will generalize to the whole column.

这篇关于Excel 2007具有2个条件的条件格式,一个基于另一个列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆