gpt4 book ai didi

excel - 基于特定数字范围之间的单元格值的 Excel 公式是什么?

转载 作者:行者123 更新时间:2023-12-04 21:14:26 25 4
gpt4 key购买 nike

我正在使用 Excel 2016我需要一个单元格公式W2基于单元格 C2 的值,具有以下逻辑:

if cell C2 is between 1 and 10, then it should output "R",
if cell C2 is between 11 and 20, then "B",
if cell C2 is between 21 and 30, then "Y",
if cell C2 is between 31 and 40, then, "G"

我正在修改 IF(AND..) 公式,但我没有做对。

这就是我现在所拥有的:
=IF(C2<=10,"R",IF(AND(C2>10,C2<=20,"B"),IF(AND(C2>20,C2<=30),"Y",IF(AND(C2>30,C2<=40),"G","!"))))

最佳答案

我认为你应该这样做(例如使用 VLOOKUP ):

=VLOOKUP(ROUNDUP(C2, -1), $C$4:$D$7, 2, FALSE)

在哪里

enter image description here

这避免了使用深度嵌套的 if-else 语句。我的意思是,如果你需要为 20 个字母这样做,你会怎么做? 20 级嵌套 if-else 语句?不。

关于excel - 基于特定数字范围之间的单元格值的 Excel 公式是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53968745/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com