简体   繁体   English

如果单元格具有特定格式,则将另一个单元格更改为特定值

[英]if a cell has specific formatting, change another cell to a specific value

if a cell has specific formatting or text, i need it to then tell another cell to be a specific value.如果一个单元格具有特定的格式或文本,我需要它然后告诉另一个单元格是一个特定的值。 see example picture enter image description here查看示例图片在此处输入图片描述

notice how because the cell is green and has white bold text, the cell right above it has a value of 2 and the red cell does not have a value.注意因为单元格是绿色的并且有白色粗体文本,它正上方的单元格的值为 2 而红色的单元格没有值。

The same can apply if a cell is red with yellow bold text.如果单元格是带有黄色粗体文本的红色单元格,则同样适用。 if this is the case, it can subtract 1 point.如果是这种情况,它可以减去 1 分。 if cell is yellow text and green background, no points are awarded or taken away.如果单元格为黄色文本和绿色背景,则不授予或不扣分。 enter image description here在此处输入图像描述

does anyone know how to accomplish this without having to manually do this every time?有谁知道如何做到这一点而不必每次都手动执行此操作? Thank you in advance.先感谢您。

Color is not data.颜色不是数据。 You can't change a cell value based on another cell's color.您不能根据另一个单元格的颜色更改单元格值。 Not with a formula and not with VBA.没有公式,也没有 VBA。 This approach is the wrong way around.这种方法是错误的。

It is quite easy to change a cell's color based on the value of another cell.根据另一个单元格的值更改单元格的颜色非常容易。 That can even be done without any formulas or VBA code, using simple conditional formatting.这甚至可以在没有任何公式或 VBA 代码的情况下使用简单的条件格式来完成。

If you or your users are in the habit of applying color and that color has a specific meaning, well, the best advice here is to change that habit.如果您或您的用户习惯于应用颜色并且该颜色具有特定含义,那么最好的建议是改变这种习惯。 Excel works on values. Excel 对值起作用。 Color is not data.颜色不是数据。 It's metadata, and not suitable to serve as the primary tool for data classification.它是元数据,不适合作为数据分类的主要工具。

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

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