TEXTBEFORE

TEXTBEFORE 函數會傳回由在原始字串值中指定子字串前顯示的所有字元組成的字串值。

TEXTBEFORE(來源字串, 搜尋字串, 次數)

來源字串: 任何值

搜尋字串: 要搜尋的字串值。

次數: 代表在來源字串中符合搜尋字串的次數(1 代表第一次符合、2 代表第二次符合…,-1 代表最後一次符合、-2 代表倒數第二次符合…)的值(可留空)。如省略,請設定為 1。

備註

  • 依照預設,如在來源字串中多次符合搜尋字串,TEXTBEFORE 會傳回由第一次符合(且不包括)前的文字。

  • 如在來源字串中找不到搜尋字串,或無法找到指定的符合次數,會傳回錯誤。

  • 搜尋字串中允許 REGEX 以進行更複雜的搜尋。

  • 依照預設,該搜尋不會區分大小寫。如要在搜尋中區分大小寫,請將 REGEX 函數用於搜尋字串

範例

=TEXTBEFORE("Marina Cavanna", " ") 會傳回「Marina」。

=TEXTBEFORE("If you want to return the text before the second to, in case there are multiple to occurrences.", "to", 2) 會傳回「If you want to return the text before the second」。

=TEXTBEFORE("All the text before the very last occurrence of the word the", "the", -1) 會傳回「All the text before the very last occurrence of the word」。

=TEXTBEFORE("Get all the text before an email like marina@example.com", REGEX("([A-Z0-9a-z._%+-]+)@([A-Za-z0-9.-]+\.[A-Za-z]{2,4})")) 會傳回「Get all the text before an email like 」。

=TEXTBEFORE("All the text before the table of contents"," ",3) 會傳回「All the text」。

Morty Proxy This is a proxified and sanitized view of the page, visit original site.
有幫助?
字元限制: 250
字元數目上限為 250。
感謝您提供意見。
Morty Proxy This is a proxified and sanitized view of the page, visit original site.