傳回字串的特定區段。
使用範本
MID("get this",5,4)
MID(A2,3,5)
語法
MID(string, starting_at, extract_length)
字串系統會從此字串擷取某個區段。starting_at- The index from the left of字串from which to begin extracting. The first character in字串has the index 1.擷取長度要擷取的區段長度。- If the end of
字串is reached before擷取長度characters are encountered,MIDreturns the characters fromstarting_atto the end of字串.
- If the end of
附註
To return the contents from
starting_atto the end of字串, useLENto calculate the length of the string that will be returned rather than simply specifying a large number 時間範圍擷取長度.To return the contents of
字串beginning with a particular character or sub-string, use次搜尋to locate the index of the desired point.
另請參閱
SUBSTITUTE: 以新文字取代字串中的現有文字。
SPLIT: 以指定字元或字串分隔文字,並將分隔後的區段放入同一列的不同儲存格。
次搜尋: 傳回在文字中找到指定字串第一次出現的位置 (不區分大小寫)。
右邊: 傳回指定字串結尾倒數幾個字元構成的子字串。
LEFT: 傳回指定字串開頭前幾個字元構成的子字串。
LEN: 傳回字串長度。