Ekstrak teks dari dalam string
=MID(text, start_num, num_chars)
| Parameter | Deskripsi |
|---|---|
text |
The text to extract from. |
start_num |
The location of the first character to extract. |
num_chars |
The number of characters to extract. |
To extract text with MID, just provide the text, the starting position, and the number of characters to extract. The formulas below show how to extrac
=MID("apple",1,1) // returns "a"
=MID("apple",1,2) // returns "ap"
=MID("apple",1,3) // returns "app"
The formula below returns 3 characters starting at the 5th character:
=MID("The cat in the hat",5,3) // returns "cat"
This formula will extract 3 characters starting at character 16:
=MID("The cat in the hat",16,3) // returns "hat"
If num_chars is greater than the remaining characters, MID will all remaining characters:
=MID("apple",1,100) // returns "apple"
This can be useful as a way to simply certain formulas as explained below. MID can extract text from numbers, but the result is text:
=MID(12348,3,4) // returns "348" as text
In the example below, we use the MID function to extract a date in YYYYMM notation from a serial number with 14 characters. The formula in cell D5, co
=MID(B5,5,6)