Let’s take a look.
Here we have some customer data.
For the first example, I’ll extract thearea codefrom thephone number.
This is a perfect utility of theLEFT function.
If I use LEFT without the second argument, it will extract just the first character.
To get thearea code, I’ll need to use “3” for the second argument.
For that, we can use the RIGHT function.
Without the second argument, RIGHT will extract just the first character from the right.
To get thezip code,I’ll need to use “5” for “num_chars.”
One way we can handle this problem is to take it in two steps.
We can do this becausestateandzip codewith a space character is always eight characters in length.
Now, the formula returns just thestate.
This is a good example of how and why formulas are nested.