Ravindra BagaleCourses & study guides मराठी Track your progress

3. Formulas and Functions

3.6 Text Functions: LEFT, RIGHT, MID, LEN, FIND and SEARCH

LEFT, RIGHT and FIND with example — in 30 seconds

What: LEFT and RIGHT take characters from the start or end of a text. FIND tells you the position of a character.

Why: The platform is hidden inside the Order ID. Pulling it out lets you count QuickKart vs ZipBasket.

Tiny example: From "ZBK-1003", =LEFT(A2,3) gives ZBK and =RIGHT(A2,4) gives 1003.

First look at the data (before → after):

LEFT, RIGHT and FIND with example: before and after tables, fictional QuickKart Maharashtra data

Expected result — Parts of the ID

A: Order ID B: Prefix C: Number D: Position of "-"
QKT-1001 QKT 1001 4
ZBK-1003 ZBK 1003 4
QKT-1007 QKT 1007 4

About this data: Teaching sample for a fictional shop “BrightLedger Finance”. Figures and names (e.g. Rohan Patil) are made up for this lesson on text functions left right mid len find and.

Before table and formula as text

Before — Order IDs

A: Order ID
QKT-1001
ZBK-1003
QKT-1007

About this data: Demo table only — not real customer or company data. Built to practise text functions left right mid len find and.

Formula / click path

B2: =LEFT(A2,3)
C2: =RIGHT(A2,4)
D2: =FIND("-",A2)

Do it step by step:

  1. In B2, type =LEFT(A2,3).
  2. In C2, type =RIGHT(A2,4).
  3. In D2, type =FIND("-",A2).
  4. Select B2:D2 and double-click the fill handle.
  5. Note: RIGHT returns text "1003". Wrap it in VALUE if you need a number.
Function Syntax Example Result
LEFT LEFT(text, [num_chars]) =LEFT("QKT-1001",3) QKT
RIGHT RIGHT(text, [num_chars]) =RIGHT("QKT-1001",4) 1001 (text)
MID MID(text, start, num_chars) =MID("PUN-Kothrud-01",5,7) Kothrud
LEN LEN(text) =LEN("Kothrud") 7
FIND FIND(find_text, within_text, [start]) =FIND("-","PUN-Kothrud-01") 4
SEARCH SEARCH(find_text, within_text, [start]) =SEARCH("k","PUN-Kothrud-01") 5

About this data: Made-up rows so you can copy the pattern for text functions left right mid len find and. Currencies may use ₹, £, € or $.

FIND is case-sensitive and has no wildcards; SEARCH ignores case and allows * and ?.

Worked example – extract the area from a store code of any length. Code in A2: NSK-College Road-01.

=MID(A2, FIND("-",A2)+1, FIND("-",A2,FIND("-",A2)+1) - FIND("-",A2) - 1)

First FIND = 4, second FIND (starting after 4) = 17. MID starts at 5 and takes 17 − 4 − 1 = 12 characters → College Road. (In Microsoft 365 the same is simply =TEXTBEFORE(TEXTAFTER(A2,"-"),"-") – see 3.9.)

Ravindra Bagale's Tip

The result of LEFT/RIGHT/MID is always text – =RIGHT("QKT-1001",4) shows 1001, but you can't SUM it. If you need a number, use =VALUE(RIGHT(A2,4)) or --RIGHT(A2,4). And if you take a fixed number of characters (for example 7), names of different lengths go wrong – find the position with FIND.

Practice task

From Order IDs like QKT-260314-001 extract the platform (QKT/ZBK), the date part (260314) and the serial number as a real number.

Loading practice tasks...

  1. Platform code (Easy): Get the first 3 characters of Order ID QKT-1001.
  2. Order number (Easy): Get the last 4 characters of Order ID ZBK-1003.
  3. IT: ticket type (Easy): On the IT sheet, get the first 3 characters of Ticket ID INC-20451-P1.
  4. IT: length of the ID (Easy): On the IT sheet, count the characters in Ticket ID INC-20451-P1.
  5. Where is the dash? (Medium): Find the position of the "-" character inside Order ID QKT-1001.
  6. Length of a city name (Medium): Count the characters in the City of order ZBK-1008 (Sambhaji Nagar).
  7. IT: ticket number (Medium): On the IT sheet, get 5 characters from Ticket ID REQ-30017-P2, starting at position 5.
  8. Middle part (Hard): Get 4 characters from Order ID QKT-1007, starting at position 5.
  9. Text before the dash (Hard): Get the text before "-" in Order ID ZBK-1003, using LEFT and FIND.
  10. IT: user name (Hard): On the IT sheet, get the user name before "@" in the Raised by (email) of ticket INC-20451-P1, using LEFT and FIND.

Quick revision cards

Three standalone cards. Each one explains the idea with its own example. Scan the QR to open this lesson.

Revision card 1: What is Text Functions Left Right Mid Len Find And?
Card 1: What is Text Functions Left Right Mid Len Find And? · Download PNG
Revision card 2: Tiny example — Text Functions Left Right Mid Len Find And
Card 2: Tiny example — Text Functions Left Right Mid Len Find And · Download PNG
Revision card 3: Checklist — Text Functions Left Right Mid Len Find And
Card 3: Checklist — Text Functions Left Right Mid Len Find And · Download PNG