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

5. Data Cleaning A–Z

5.8 Splitting Columns

Split a column with TEXTSPLIT with example — in 30 seconds

What: TEXTSPLIT cuts one text into several cells at a delimiter such as a comma. TRIM removes the space after each comma.

Why: City, Area and Store ID in one cell cannot be filtered or looked up. Three columns can.

Tiny example: "Pune, Kothrud, BLK-PUN-01" spills into Pune | Kothrud | BLK-PUN-01.

First look at the data (before → after):

Split a column with TEXTSPLIT with example: before and after tables, fictional FreshGo Maharashtra data

Expected result — After TEXTSPLIT + TRIM

B: City C: Area D: Store ID
Pune Kothrud BLK-PUN-01
Nashik College Road BLK-NSK-01
Nagpur Dharampeth AMN-NGP-01

About this data: Teaching sample for a fictional shop “GreenField Dairy”. Figures and names (e.g. Vikram Rao) are made up for this lesson on splitting columns.

Before table and formula as text

Before — One column holds three facts

A: Location
Pune, Kothrud, BLK-PUN-01
Nashik, College Road, BLK-NSK-01
Nagpur, Dharampeth, AMN-NGP-01

About this data: Demo table only — not real customer or company data. Built to practise splitting columns.

Formula / click path

B2: =TRIM(TEXTSPLIT(A2,","))   → spills into B2:D2

Do it step by step:

  1. Click B2. Keep C2:D2 empty so the result can spill.
  2. Type =TRIM(TEXTSPLIT(A2,",")) and press Enter.
  3. Copy B2 down to the other rows.
  4. If you see #SPILL!, clear the cells to the right.
  5. No Microsoft 365? Use Data › Text to Columns › Delimited › Comma instead.

Before

Location
Kothrud, Pune, 411038
College Road, Nashik, 422005
Dharampeth, Nagpur, 440010

About this data: Made-up rows so you can copy the pattern for splitting columns. Currencies may use ₹, £, € or $.

After

Area City Pincode
Kothrud Pune 411038
College Road Nashik 422005
Dharampeth Nagpur 440010

About this data: Fictional worksheet used in class. Safe to edit; nothing here is live production data.

Steps in Excel – three ways

  1. Text to Columns: insert two empty columns to the right › select the column › Data › Data Tools › Text to Columns › Delimited › tick Comma (and Treat consecutive delimiters as one) › in step 3 set Pincode to Text if you want to keep it as a code › Finish. Then TRIM the leading spaces.
  2. Flash Fill: type Kothrud in B2 › Ctrl + E; Pune in C2 › Ctrl + E; 411038 in D2 › Ctrl + E.
  3. TEXTSPLIT (Microsoft 365 / Excel 2024): =TRIM(TEXTSPLIT(A2,",")) spills the three parts.

Pincodes shown are fictional-style examples for the areas.

Ravindra Bagale's Tip

Text to Columns overwrites the columns on the right – that's how many students' neighbouring data disappears. Before splitting, insert enough empty columns to the right. And a space remains after the comma, so don't forget TRIM after splitting.

Practice task

Split "Area, City, Pincode" for ten stores using all three methods. Compare which one updates automatically when the source changes.

Loading practice tasks...

  1. Total parcels (Easy): Add up the "Parcels" column. (sheet "Data")
  2. Average cost (Easy): Average of the Cost (£) column, rounded to 2 decimals. (sheet "Data")
  3. Rows in Royal Mail (Easy): How many rows have Carrier "Royal Mail"? (sheet "Data")
  4. Largest parcels (Easy): The largest value in the "Parcels" column. (sheet "Data")
  5. Clean name (Easy): Trim the "Name" value in the first row. (sheet "Text")
  6. Proper case (Easy): the "Name" value in the first row trimmed and in proper case. (sheet "Text")
  7. Code prefix (Easy): First 3 characters of the "Carrier" value in the first row. (sheet "Text")
  8. Code number (Easy): Last 4 characters of the "Carrier" value in row 3. (sheet "Text")
  9. Parcels for Royal Mail (Medium): Total of the Parcels column where Carrier is "Royal Mail". (sheet "Data")
  10. Royal Mail in Glasgow (Medium): Total of the Parcels column where Carrier is "Royal Mail" and City is "Glasgow". (sheet "Data")
  11. City part (Medium): Characters 5 to 7 of the "Carrier" value in row 4. (sheet "Text")
  12. Name length (Medium): Length of the "Name" value in row 3. (sheet "Text")

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 Splitting Columns?
Card 1: What is Splitting Columns? · Download PNG
Revision card 2: Tiny example — Splitting Columns
Card 2: Tiny example — Splitting Columns · Download PNG
Revision card 3: Checklist — Splitting Columns
Card 3: Checklist — Splitting Columns · Download PNG