Functions LEFT – RIGHT – MID

Functions LEFT – RIGHT – MID
Last Updated on 18/04/2024
Reading time: 2 minutes

The functions LEFT, RIGHT, and MID are crucials with you work with Excel

The LEFT function

We want to extract the dialing code of a phone number. The dialing code is the first 3 digits of the phone number. To extract these figures, we will use the function LEFT.

This function is very simple to use because you only need 2 pieces of information:

  1. your initial text (generally the reference of a cell)
  2. the number of digits you want to extract (3 in this case).

The function has the following writing:

=LEFT(B2,3)

Function LEFT in Excel
Function LEFT in Excel

RIGHT function

In the same way, if you want to extract the last 4 digits of the phone number, you use this time the function RIGHTas follow:

=RIGHT(B2,4)

Function RIGHT in Excel
Function RIGHT in Excel

MID function

It is also possible to extract a part of a string in the middle. To do that, you will use the MID function.

To write this function, you must

  • First, put the reference of the cell
  • Second, indicate the position where you want to start the extraction (in our example, position 9)
  • Third, indicate the number of characters you want to extract (8 characters to return)

So, if you want to extract the mobile phone number of the cell B8 in the cell C8, you will write the following formula:

 =MID(B2,9,8)

Function MID in Excel
Function MID in Excel

In this example

  • 20 represents the number of characters to start
  • 8 represents the phone number (7 digits + the dash)

Other TEXT functions in Excel

The functions LEFT, RIGHT, MID play a crucial role in extracting segments of a string. Additionally, you can employ other functions to extract even more intricate substrings.

2 Comments

  1. Phil
    24/03/2019 @ 13:37

    =RIGHT(B2,3)

    Shouldn't 3 be 4 in this formula?

    pdp

    Reply

    • Frédéric LE GUEN
      24/03/2019 @ 14:20

      True ! Thanks

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Functions LEFT – RIGHT – MID

Reading time: 2 minutes
Last Updated on 18/04/2024

The functions LEFT, RIGHT, and MID are crucials with you work with Excel

The LEFT function

We want to extract the dialing code of a phone number. The dialing code is the first 3 digits of the phone number. To extract these figures, we will use the function LEFT.

This function is very simple to use because you only need 2 pieces of information:

  1. your initial text (generally the reference of a cell)
  2. the number of digits you want to extract (3 in this case).

The function has the following writing:

=LEFT(B2,3)

Function LEFT in Excel
Function LEFT in Excel

RIGHT function

In the same way, if you want to extract the last 4 digits of the phone number, you use this time the function RIGHTas follow:

=RIGHT(B2,4)

Function RIGHT in Excel
Function RIGHT in Excel

MID function

It is also possible to extract a part of a string in the middle. To do that, you will use the MID function.

To write this function, you must

  • First, put the reference of the cell
  • Second, indicate the position where you want to start the extraction (in our example, position 9)
  • Third, indicate the number of characters you want to extract (8 characters to return)

So, if you want to extract the mobile phone number of the cell B8 in the cell C8, you will write the following formula:

 =MID(B2,9,8)

Function MID in Excel
Function MID in Excel

In this example

  • 20 represents the number of characters to start
  • 8 represents the phone number (7 digits + the dash)

Other TEXT functions in Excel

The functions LEFT, RIGHT, MID play a crucial role in extracting segments of a string. Additionally, you can employ other functions to extract even more intricate substrings.

2 Comments

  1. Phil
    24/03/2019 @ 13:37

    =RIGHT(B2,3)

    Shouldn't 3 be 4 in this formula?

    pdp

    Reply

    • Frédéric LE GUEN
      24/03/2019 @ 14:20

      True ! Thanks

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *