如何将这 3 个条件组合在一个 Excel 公式中?

nmu*_*ntz 2 microsoft-excel-2007 worksheet-function microsoft-excel

我需要根据以下内容创建一个excel公式:

1. If Cell >= 500 Then the Cell text should be "Critical"
2. If Cell >= 400 Then the cell text should be "Medium"
3. If cell < 400 then the cell text should be "Normal"
Run Code Online (Sandbox Code Playgroud)

我目前有

=IF(OFFSET(H2;0;-1)>500;"Critical"; IF(OFFSET(H2;0;-1)<=500;"Normal";))
Run Code Online (Sandbox Code Playgroud)

但是,一旦我添加了第三个条件,它就不会接受它并给我错误并使整个事情变得一团糟。

DMA*_*361 5

你不需要第三个条件。你需要这样做:

Is value >= 500? If yes then "Critical" else continue:
Is value >= 400? If yes then "Medium" else "Normal"
Run Code Online (Sandbox Code Playgroud)

因此,您需要执行以下操作:

IF( DESREF(H2;0;-1)>=500 ; "Critical" ; IF( DESREF(H2;0;-1)>=400 ; "Medium" ; "Normal ) )
Run Code Online (Sandbox Code Playgroud)

并且,为了可读性而换行:

IF( DESREF(H2;0;-1)>=500 ; "Critical" ; 
                             IF( DESREF(H2;0;-1)>=400 ; "Medium" ; "Normal ) )
Run Code Online (Sandbox Code Playgroud)


Meh*_*lar 5

假设您正在评估单元格 A1,请输入以下公式,它将适用于您的条件:

=IF(A1>=500,"Critical",IF(A1>=400,"Medium","Normal"))
Run Code Online (Sandbox Code Playgroud)