css 根据条件显示颜色
I like to color data entry cells, so they’re easy to spot on an Excel worksheet. If you know that you should type a value in every blue cell, it’s quicker, and safer, to fill in a worksheet.
我喜欢给数据输入单元格上色,因此很容易在Excel工作表上发现它们。 如果您知道应该在每个蓝色单元格中键入一个值,则填写工作表会更快,更安全。
Recently, I was asked how to color a specific number of data entry cells, based on a number that someone selected from a drop down list. So, instead of manually coloring the data entry cells, I used conditional formatting to color them.
最近,有人问我如何根据某人从下拉列表中选择的数字为特定数量的数据输入单元着色。 因此,我没有使用人工为数据输入单元着色,而是使用条件格式为它们着色。
In the screen shot below, 3 was selected in cell C2, so 3 data entry cells are blue, in cells C5:C7.
在下面的屏幕截图中,在单元格C2中选择了3个,因此在单元格C5:C7中3个数据输入单元是蓝色的。
![condformatcolor02 condformatcolor02](https://i-blog.csdnimg.cn/blog_migrate/d666e410186b2741fac627937f545bf8.png)
选择颜色 (Select a Color)
Another feature in this workbook is the drop down list of colors in column C. After you select a color, a sample of that color appears in column D. Select a different color from the drop down, and the sample color will change.
该工作簿的另一个功能是C列中的颜色下拉列表。选择一种颜色后,该颜色的样本将显示在D列中。从下拉列表中选择其他颜色,样本颜色将发生变化。
This is also done with conditional formatting – no macros required. There are 3 colors set up in the sample file, with a separate rule for each color. You could set up more rules if necessary.
这也可以通过条件格式完成-不需要宏。 示例文件中设置了3种颜色,每种颜色都有单独的规则。 如有必要,您可以设置更多规则。
![condformatcolor16 condformatcolor16](https://i-blog.csdnimg.cn/blog_migrate/7265b7e589856721c6a2c75dbc81959b.png)
详细说明 (Detailed Instructions)
On my website, you can follow the step-by-step written instructions, to see how to set up the workbook, with lists in named ranges, and add the data validation and conditional formatting. Or, watch the video below, if you’d prefer to see me build the workbook, rather than read the steps.
在我的网站上,您可以按照分步的书面说明进行操作 ,以了解如何设置工作簿以及命名范围内的列表,并添加数据验证和条件格式。 或者,如果您希望看到我来制作工作簿,而不是阅读这些步骤,请观看下面的视频。
![condformatcolor05 condformatcolor05](https://i-blog.csdnimg.cn/blog_migrate/2c9c05a48f61493e23f44d694fa0a641.png)
视频:条件格式颜色 (Video: Conditional Formatting Colors)
To see the steps for setting up the workbook, and adding drop down lists and conditional formatting rules, please watch this video tutorial.
要查看设置工作簿以及添加下拉列表和条件格式设置规则的步骤,请观看此视频教程。
Or Watch on YouTube: Color Excel Data Entry Cells With Conditional Formatting
或在YouTube上观看: 带有条件格式的Excel彩色数据输入单元格
下载样本文件 (Download the Sample File)
To see how the conditional formatting works, you can download the sample file from my Contextures website. The zipped file is in xlsx format, and does not contain macros.
若要查看条件格式的工作原理,可以从Contextures网站下载示例文件 。 压缩文件为xlsx格式,不包含宏。
翻译自: https://contexturesblog.com/archives/2014/09/25/show-color-with-conditional-formatting/
css 根据条件显示颜色