在Google表格或Excel中,有没有一种简单的方法可以根据另一个单元格的几个可能值之一将值插入单元格?
换句话说,
A1
包含“红色”,则B1
应填充“危险”A1
包含“蓝色”,那么B1
应填充“正常”A1
包含“绿色”,那么B1
应填写“继续”编写这种匹配的语法是什么?
提前致谢!
答案 0 :(得分:3)
答案 1 :(得分:1)
使用B1中的以下行来获得答案。确保在A1中找到正确的拼写,否则如果A1为空或拼写错误,您将看到FALSE。
=IF(A1="red","Hazard",IF(A1="blue","normal",IF(A1="green","proceed")))
答案 2 :(得分:0)
这是一种基于细胞的不同方法。颜色
选项明确
Public Function ColorIndexes(Rango As Range) As Variant
Application.Volatile
If Rango.Interior.ColorIndex = 3 Then
ColorIndexes = "Hazzard"
ElseIf Rango.Interior.ColorIndex = 24 Or Rango.Interior.ColorIndex = 37 Or Rango.Interior.ColorIndex = 23 Or Rango.Interior.ColorIndex = 49 Then
ColorIndexes = "Normal"
ElseIf Rango.Interior.ColorIndex = 50 Or Rango.Interior.ColorIndex = 35 Or Rango.Interior.ColorIndex = 48 Or Rango.Interior.ColorIndex = 12 Or Rango.Interior.ColorIndex = 56 Or Rango.Interior.ColorIndex = 14 Then
ColorIndexes = "Proceed"
Else
ColorIndexes = "Not matched"
End If
End Function