Excel:可以根据单元格的颜色创建条件公式吗? [英] Excel: Can I create a Conditional Formula based on the Color of a Cell?

查看:291
本文介绍了Excel:可以根据单元格的颜色创建条件公式吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个初学者,尝试创建一个公式,根据B2中单元格的颜色修改单元格A1的内容;



如果单元格B2 = [color color]然后显示FQS。



如果单元格B2 = [黄色]然后显示SM。



这是基于单元格填充颜色的条件。

解决方案

不幸的是,没有直接的方法来做到这一点单一公式。但是,存在一个相当简单的解决方法。



在Excel功能区上,转到公式,然后单击名称管理器。选择新建,然后输入CellColor作为名称。跳转到参考部分并输入以下内容:

  = GET.CELL(63,OFFSET(INDIRECT RC,FALSE),1,1))

点击确定,然后关闭名称管理器窗口



现在,在单元格A1中输入以下内容:

  = IF(CellColor = 3,FQS,IF(CellColor = 6,SM,))

这将返回FQS为红色,SM为黄色。对于任何其他颜色,单元格将保持空白。



***如果A1中的值不更新,请在键盘上点击F9以强制Excel更新任何时候的计算(或如果B2中的颜色有变化)。



以下是单元格填充颜色列表的参考(有56个可用)如果你想要展开东西:
http://www.smixe.com/excel-color-pallette。 html



干杯。



:: 修改 ::



如果名称管理器中使用的公式有助于您了解其工作原理,则可以进一步简化名称管理器中使用的公式(上述包含的版本更加灵活,更易于使用)在复制时检查多个单元格引用,因为它使用自己的单元格地址作为参考点,而不是专门针对单元格B2)。



无论哪种方式,如果你想为了简化事情,可以在Name Man中使用这个公式代替:

  = GET.CELL(63,Sheet1!B2)
/ pre>

I'm a beginner and trying to create a formula that modifies the contents of Cell A1 based on the color of the cell in B2;

If Cell B2 = [the color red] then display FQS.

If Cell B2 = [the color yellow] then display SM.

This is conditional based on the cell fill color.

解决方案

Unfortunately, there is not a direct way to do this with a single formula. However, there is a fairly simple workaround that exists.

On the Excel Ribbon, go to "Formulas" and click on "Name Manager". Select "New" and then enter "CellColor" as the "Name". Jump down to the "Refers to" part and enter the following:

=GET.CELL(63,OFFSET(INDIRECT("RC",FALSE),1,1))

Hit OK then close the "Name Manager" window.

Now, in cell A1 enter the following:

=IF(CellColor=3,"FQS",IF(CellColor=6,"SM",""))

This will return FQS for red and SM for yellow. For any other color the cell will remain blank.

***If the value in A1 doesn't update, hit 'F9' on your keyboard to force Excel to update the calculations at any point (or if the color in B2 ever changes).

Below is a reference for a list of cell fill colors (there are 56 available) if you ever want to expand things: http://www.smixe.com/excel-color-pallette.html

Cheers.

::Edit::

The formula used in Name Manager can be further simplified if it helps your understanding of how it works (the version that I included above is a lot more flexible and is easier to use in checking multiple cell references when copied around as it uses its own cell address as a reference point instead of specifically targeting cell B2).

Either way, if you'd like to simplify things, you can use this formula in Name Manager instead:

=GET.CELL(63,Sheet1!B2)

这篇关于Excel:可以根据单元格的颜色创建条件公式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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