This category contains the Logical functions.
Zero (0) is equivalent to FALSE and all other numbers are equivalent to TRUE.
Empty cells and text in cells are ignored.
A #VALUE error is raised if all arguments are ignored.
A #VALUE error is raised if one argument is direct text (not text in a cell).
Errors as argument lead to an error.
如果所有引數是 TRUE 則傳回 TRUE。 如果其中一個元素是 FALSE,此函式會傳回 FALSE 值。
這些引數可能是本身傳回邏輯值的邏輯表示式 (TRUE, 1<5, 2+3=7, B8<10),或包含邏輯值的陣列 (A1:C3)。
AND(Logical 1 [; Logical 2 [; … [; Logical 255]]])
即將檢查條目 12<13、14>12 與 7<6 的邏輯值:
=AND(12<13;14>12;7<6) 傳回 FALSE。
=AND(FALSE();TRUE()) returns FALSE.
The array formula {=AND(B1:B10;C1:C10)} yields a one-dimensional value of TRUE when all components of B1:B10 and C1:C10 are TRUE. The array expression above does not produce the logical AND per element, and thus does not produce an array of logical values. To compute a logical AND of arrays per element use the * operator in array context. In the example, enter {=B1:B10*C1:C10}.
傳回邏輯值 FALSE。 FALSE() 函式不需要任何引數,而且會一直傳回邏輯值 FALSE。
FALSE()
=FALSE() 傳回 FALSE。
=NOT(FALSE()) 傳回 TRUE。
指定要執行的邏輯測試。
IF(Test [; [ThenValue] [; [OtherwiseValue]]])
Test 是任意值或可為 TRUE 或 FALSE 的表示式。
若邏輯測試為 TRUE,則 (選擇性) 傳回 ThenValue。
若邏輯測試為 FALSE,則 (選擇性) 傳回 OtherwiseValue。
=IF(A1>5;100;"too small") If the value in A1 is greater than 5, the value 100 is returned; otherwise, the text too small is returned.
=IF(A1>5;;"too small") If the value in A1 is greater than 5, the value 0 is returned because empty parameters are considered to be 0; otherwise, the text too small is returned.
=IF(A1>5;100;) If the value in A1 is less than 5, the value 0 is returned because the empty OtherwiseValue is interpreted as 0; otherwise 100 is returned.
反轉邏輯值。
NOT(LogicalValue)
LogicalValue 是要反轉的值。
=NOT(A)。若 A=TRUE,則 NOT(A) 將評估 FALSE。
如果至少一個引數是 TRUE 則傳回 TRUE。 如果所有引數邏輯值均為 FALSE,此函式則傳回值 FALSE。
這些引數可能是本身傳回邏輯值的邏輯表示式 (TRUE, 1<5, 2+3=7, B8<10),或包含邏輯值的陣列 (A1:C3)。
OR(Logical 1 [; Logical 2 [; … [; Logical 255]]])
即將檢查條目 12<11、13>22 與 45=45 的邏輯值。
=OR(12<11;13>22;45=45) 傳回 TRUE。
=OR(FALSE();TRUE()) returns TRUE.
The array formula {=OR(B1:B10;C1:C10)} yields a one-dimensional value of FALSE when all components of B1:B10 and C1:C10 are FALSE. The array expression above does not produce the logical OR per element, and thus does not produce an array of logical values. To compute a logical OR of arrays per element use the + operator in array context. In the example, enter {=B1:B10+C1:C10}.
邏輯值設為 TRUE。 TRUE() 函式不需要任何引數,而且會一直傳回邏輯值 TRUE。
TRUE()
如果 A=TRUE 而 B=FALSE,下列範例出現:
=AND(A;B) 傳回 FALSE。
=OR(A;B) 傳回 TRUE。
=NOT(AND(A;B)) 傳回 TRUE。
Returns true if an odd number of arguments evaluates to TRUE.
這些引數可能是本身傳回邏輯值的邏輯表示式 (TRUE, 1<5, 2+3=7, B8<10),或包含邏輯值的陣列 (A1:C3)。
XOR(Logical 1 [; Logical 2 [; … [; Logical 255]]])
=XOR(TRUE();TRUE()) returns FALSE
=XOR(TRUE();TRUE();TRUE()) returns TRUE
=XOR(FALSE();TRUE()) returns TRUE