The MID function
Extracting a piece from the middle of a text: the month in "2024-03-15", the number in a reference.
Syntax
=MID(text, start_num, num_chars)
In a French Excel: =STXT(texte; no_départ; no_car).
Arguments
- text: the cell.
- start_num: the position of the first character wanted, 1 being the first.
- num_chars: how many characters.
An example
=MID("FR-2024-0042",4,4)
Returns "2024".
Pitfalls
- The result is text: "2024" is not a number;
=VALUE(MID(…))converts it. - The French name has nothing to do with it: MID is called STXT.
Going further
Frequently asked questions
- What does MID return if the text is shorter?
- What is left, with no error:
=MID("abc",2,10)returns "bc".