简体   繁体   English

基于另一个值的百分比的色标条件格式

[英]Color Scale Conditional Formatting based on percentage of another value

I am trying to color Column A based on its percentage of value in Column B. Column B value could be 3, 6, 9 or 12, so I cannot just take a raw number as the minimum, mid or maximum value, it has to be a percentage.我正在尝试根据 A 列在 B 列中的百分比值为其着色。B列值可以是 3、6、9 或 12,因此我不能只将原始数字作为最小值、中间值或最大值,它必须是一个百分比。 And I would like to do this without inserting an extra column which calculates the percentage.我想在不插入计算百分比的额外列的情况下执行此操作。 Below is an image with how the two columns may look like.下面是一张图片,其中包含两列的外观。

两列示例的图片

What works is adding an extra column in which the percentage is calculated using the formula:有效的是添加一个额外的列,其中使用以下公式计算百分比:

=TO_PERCENT(A2/B2)

with the Color Scale Conditional Formatting looking something like this:色阶条件格式看起来像这样:

在此处输入图像描述

在此处输入图像描述

But I don't want an extra column showing the percentage , I would rather color the numbers in Column A based on what percentage they are of Column B. What I thought would work is the following:但是我不想要一个额外的列来显示百分比,我宁愿根据它们在 B 列中的百分比来为 A 列中的数字着色。我认为可行的是:

在此处输入图像描述

在此处输入图像描述

The formulas being:公式为:

=TO_PERCENT($A2/$B2)>=0%
=TO_PERCENT($A2/$B2)>=50%
=TO_PERCENT($A2/$B2)>=100%

With or without TO_PERCENT , as you can see, the result is the same - everything under the midpoint, which should be red, is actually green.无论有没有TO_PERCENT ,如您所见,结果都是一样的——中点以下的所有内容,应该是红色的,实际上是绿色的。 I am unsure as to what is causing this, nor how to fix this or if there is any feasible alternative to properly color scale based on value's percentage of another value.我不确定是什么原因造成的,也不确定如何解决这个问题,或者是否有任何可行的替代方法可以根据值与另一个值的百分比正确地进行色标。

You shouldn't use Colour scaling like that.你不应该那样使用颜色缩放。 Consider that even if it analyses it, an expression like =TO_PERCENT($A2/$B2)>=0% will actually return 0 when false and 1 when true, so it's not going to be comparable to your columns考虑到即使它对其进行分析,像=TO_PERCENT($A2/$B2)>=0%这样的表达式实际上会在 false 时返回 0,在 true 时返回 1,因此它不会与您的列进行比较

It's a little uncomfortable, but what you should do is to create your own scaling by setting each of your formulas to each desired colour.这有点不舒服,但您应该做的是通过将每个公式设置为每种所需的颜色来创建自己的缩放比例。 Keep in mind the order of the rules, the highest values should go up记住顺序规则,最高值应该go向上

在此处输入图像描述

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

相关问题 基于另一张纸的值的条件格式 - Conditional Formatting based on value of another sheet 基于另一个单元格的值的条件格式 - Conditional formatting based on another cell's value 有条件地格式化单元格以根据另一个选项卡中单元格的内容更改颜色 - Conditional formatting a cell to change color based on the content of a cell in another tab 条件格式:根据与另一个单元格的比较为单元格着色 - Conditional formatting: color a cell based on a comparison with another cell Google电子表格中带有条件格式的色标 - Color scale with conditional formatting in Google Spreadsheet Google 表格:条件格式 - 根据另一个单元格的值在一个范围内为一行中的所有非空单元格着色? - Google Sheets: Conditional Formatting - color all non-empty cells in a row within a range based on the value of another cell? 通过条件格式突出显示基于另一个单元格值的单元格 - Highlight cells based on another cell's value through conditional formatting 基于另一个单元格的条件格式 - Conditional Formatting based on another cell 基于另一个范围的条件格式 - Conditional Formatting based on Another Range 如何根据单元格颜色应用条件格式? - How to apply conditional formatting based on a cell color?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM