简体   繁体   English

基于多条规则的条件格式

[英]Conditional Formatting Based on Multiple Rules

I'm trying to create a multi rule custom formula for conditional formatting purposes in Google Sheets.我正在尝试为 Google 表格中的条件格式创建多规则自定义公式。

Here is what I want to achieve -这是我想要实现的目标 -

If Deal Size is Small, the deal length cell should be highlighted a specific color based on the criteria -如果交易规模较小,则交易长度单元格应根据标准以特定颜色突出显示 -

  • 0-35 Green 0-35 绿色

  • 35-40 Yellow 35-40 黄色

  • 40+ Red 40+ 红色

If Deal Size is Large, the deal length cell should be highlighted a specific color based on the criteria -如果交易规模很大,则交易长度单元格应根据标准以特定颜色突出显示 -

  • 0-45 Green 0-45 绿色

  • 45-55 Yellow 45-55黄

  • 55+ Red 55+ 红色

Here is some sample data -这是一些示例数据 -

Date Deal Started交易开始日期 Date Deal Ended交易结束日期 Deal Length交易长度 Deal Size交易规模
1/13/2023 2023 年 1 月 13 日 1/25/2023 2023 年 1 月 25 日 12 12 Small小的
12/8/2022 12/8/2022 1/17/2023 2023 年 1 月 17 日 40 40 Large大的
11/8/2022 11/8/2022 1/9/2023 2023 年 1 月 9 日 62 62 Small小的
10/7/2022 10/7/2022 1/31/2023 2023 年 1 月 31 日 116 116 Large大的
12/12/2022 12/12/2022 1/30/2023 2023 年 1 月 30 日 49 49 Large大的

I've read some blogs online but haven't found a solution for what I want to achieve.我已经在线阅读了一些博客,但还没有找到我想要实现的解决方案。

0-35 for green and 35-40 for yellow.绿色为 0-35,黄色为 35-40。 So what color if exactly 35?那么如果恰好是 35 是什么颜色呢?

Use 3 custom formulas for conditional formatting.使用 3 个自定义公式进行条件格式设置。 Move = signs where needed.在需要的地方移动 = 标志。 Range in example C2:C7示例中的范围C2:C7

Green:绿色的:

=OR(AND(D2="Small",C2>0,C2<35),AND(D2="Large",C2>0,C2<45))

Yellow:黄色的:

=OR(AND(D2="Small",C2>=35,C2<40),AND(D2="Large",C2>=45,C2<55))

Red:红色的:

=OR(AND(D2="Small",C2>=40),AND(D2="Large",C2>=55))

Result:结果:

在此处输入图像描述

or you can do it like this too:或者你也可以这样做:

green:绿色的:

=((D2="Small")*(C2>0)*(C2<35))+((D2="Large")*(C2>0)*(C2<45))

yellow:黄色的:

=((D2="Small")*(C2>=35)*(C2<40))+((D2="Large")*(C2>=45)*(C2<55))

red:红色的:

=((D2="Small")*(C2>=40))+((D2="Large")*(C2>=55))

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

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