-如何打這公式用excel 的=if(and

2008-07-01 8:35 am
excel -如何打這公式

想用=if(and..........

細過5,就bad,
大過10.就good,
等於6就noraml,

回答 (4)

2008-07-01 9:28 am
✔ 最佳答案
IF公式只可以存在True或False,無中位數。若你要做到normal,就需要編寫VBA程式。

你可以參考以下程式:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
If Target.Value < 5 Then
Me.Rows(1).Cells(2).Value = "bad"
ElseIf Target.Value > 10 Then
Me.Rows(1).Cells(2).Value = "good"
Else
Me.Rows(1).Cells(2).Value = "normal"
End If
End If
End Sub
2008-07-01 9:11 pm
7 至 10 是什麼?
是否會有小數 或 負數?
2008-07-01 6:54 pm
唔駛咁複雜,好簡單咋﹗
假設要判斷的資料位於儲存格A1 , 要顯示的結果為於A2

在A2中輸入:

=IF(A1<=5,"Bad",IF(A1=6,"Normal",IF(A1>=10,"Good",)))

但如果A1的值不符合以上條件,
即A1 = 7-9

則會顯示出 0

結果將會在儲存格A2中顯示。
2008-07-01 9:30 am
easiest way is to use this formula,

let's say you want to check cell "A1", use this:

=IF(A1<5,"good",IF(A1>5,"bad",IF(A1=5,"normal")))

make sure the value is in A1, and the formula is somewhere else, it will work everytime.

2008-07-01 01:31:56 補充:
Sorry, this is using your exact example, it will be:

細過5,就bad,
大過10.就good,
等於6就noraml,

=IF(A1<5,"bad",IF(A1>10,"good",IF(A1=6,"normal")))

2008-07-01 01:37:48 補充:
also, if you want to account for error checking for the input; that is of value "5", "7", "8", "9", "10", use this:

=IF(A1<5,"bad",IF(A1>10,"good",IF(A1=6,"normal","wrong input")))

the message "wrong input" will be displayed if A1 is one of the following values, 5, 7-10.


收錄日期: 2021-04-13 15:46:34
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20080701000051KK00122

檢視 Wayback Machine 備份