如何纠正一个if语句,然后加上这个数字

时间:2019-04-27 15:55:25

标签: excel

我在处理一个简单的excel方程时遇到麻烦,我需要这样做,如果E23等于或大于25000,则添加O4

如果可能的话,这是否可能,我需要知道该怎么做,如果相同的话(但对于值30000、40000和50000),还要在函数中再添加3次

先谢谢您

3 个答案:

答案 0 :(得分:0)

因此,对于第一个问题,请尝试:

=IF(E23>=25000,E23+O4,0)

您可以立即更改所需的值。

答案 1 :(得分:0)

我不确定要添加什么内容,但下面的公式应该可以帮助您达到目标;

=IFERROR(IFS($E$23>=50000,$E$23+$O$4,$E$23>=40000,$E$23+$O$4,$E$23>=30000,$E$23+$O$4,$E$23>=25000,$E$23+$O$4),"")

E23+O4替换为您想要的结果。

答案 2 :(得分:0)

您可以为此使用VBA功能。

Public Function DoSomething(cell1 As Variant, cell2 As Variant) AS Variant
    If IsNumeric(cell1) = False OR IsNumeric(cell2) = False Then
        DoSomething = ""
        Exit Function
    End If

    If cell1 >= 25000 Then
        DoSomething = cell1 + cell2
        Exit Funtion
    ElseIf cell1 >= 30000 Then
        'Do something different
    ElseIf cell1 >= 40000 Then
        'Do something different
    ElseIf cell1 >= 50000 Then
        'Do something else
    Else
        DoSomething = ""
        Exit Function
End Function