Warning: This Help page is relevant to LibreOffice up to version 6.0.
For updated Help pages, visit https://help.libreoffice.org.

空白儲存格的處理方式

From LibreOffice Help
Jump to navigation Jump to search

在較舊版的軟體中,空白儲存格在部分環境均會強制為數值 0,在其他環境中則會強制為空白字串,但直接比較除外,在這類比較中,若 A1 是空白,則 =A1=0 和 =A1="" 均會產生 TRUE。目前已繼承空白,仍可繼續使用,因此,若因此搜尋而傳回了空白儲存格,則 =VLOOKUP(...)=0 與 =VLOOKUP(...)="" 均會傳回 TRUE。

對於空白儲存格的簡單參照仍會顯示為數值 0,但其類型不再需要是數值,因此也可以視需要與參照儲存格進行比較。

針對下列範例,A1 包含一個數字、B1 是空白,而 C1 則包含對於 B1 的參照:

A1: 1 B1: <空白> C1: =B1 (顯示 0)

=B1=0 => TRUE

=B1="" => TRUE

=C1=0 => TRUE

=C1="" => TRUE (先前為 FALSE)

=ISNUMBER(B1) => FALSE

=ISNUMBER(C1) => FALSE (先前為 TRUE)

=ISNUMBER(VLOOKUP(1;A1:C1;2)) => FALSE (B1)

=ISNUMBER(VLOOKUP(1;A1:C1;3)) => FALSE (C1,先前為 TRUE)

=ISTEXT(B1) => FALSE

=ISTEXT(C1) => FALSE

=ISTEXT(VLOOKUP(1;A1:C1;2)) => FALSE (B1,先前為 TRUE)

=ISTEXT(VLOOKUP(1;A1:C1;3)) => FALSE (C1)

=ISBLANK(B1) => TRUE

=ISBLANK(C1) => FALSE

=ISBLANK(VLOOKUP(1;A1:C1;2)) => TRUE (B1,先前為 FALSE)

=ISBLANK(VLOOKUP(1;A1:C1;3)) => FALSE (C1)

Note.png 請注意,Microsoft Excel 的運作方式不同,而且一律會傳回數值,做為對於空白儲存格之參照或含有空白儲存格結果之公式的結果。例如:

A1: <空白>

B1: =A1 => 顯示 0,但僅是對於空白儲存格的參照

=ISNUMBER(A1) => FALSE

=ISTEXT(A1) => FALSE

=A1=0 => TRUE

=A1="" => TRUE

=ISNUMBER(B1) => FALSE (MS-Excel:TRUE)

=ISTEXT(B1) => FALSE

=B1=0 => TRUE

=B1="" => TRUE (MS-Excel:FALSE)

C1: =VLOOKUP(...) 含有空白儲存格的結果 => 顯示空白 (MS-Excel:顯示 0)

=ISNUMBER(VLOOKUP(...)) => FALSE

=ISTEXT(VLOOKUP(...)) => FALSE

=ISNUMBER(C1) => FALSE (MS-Excel:TRUE)

=ISTEXT(C1) => FALSE