LEFT


Returns text from the left side of a text string.

Syntax:

LEFT(text, number)

returns number characters from the left side of the text text.number defaults to 1 if omitted.

Example:

LEFT("output", 3)


Application:

Imagine you have a list of product IDs in a database. Each product ID is structured with a two-letter department code at the beginning, followed by a unique five-digit item number. You need to create a new report that only shows the department code for each product.


Table: Products

Product ID

Product Name

Price

A
B
C
1
EL-10045
Laptop
$1,200.00
2
HW-23198
Hammer
$25.00
3
EL-56723
Smartphone
$800.00
4
FA-89012
T-Shirt
$20.00
5
HW-34567
Screwdriver
$15.00

Goal:

Extract the two-letter department code from the ProductID column.


LEFT Function Application:

The formula to achieve this would be LEFT(ProductID, 2).

  • ProductID: This is the text string you want to operate on.
  • 2: This is the number of characters you want to extract from the left side of the string.


Resulting Table (Using the LEFT function):

Product ID

Product Name

Price

Department Code

A
B
C
D
1
EL-10045
Laptop
$1,200.00
EL
2
HW-23198
Hammer
$25.00
HW
3
EL-56723
Smartphone
$800.00
EL
4
FA-89012
T-Shirt
$20.00
FA
5
HW-34567
Screwdriver
$15.00
HW




This page is protected by Google reCAPTCHA. Privacy - Terms.
 
Built using Zapof