Flash Fill, Text to Columns and Standardising Messy Data
Clean messy exports fast. Use Flash Fill to learn a pattern from examples, Text to Columns to split values, and formulas to standardise case, spacing, phone numbers and dates, then check every result before you rely on it.
● Gap-fill lesson✦ Excel for Microsoft 365, 2026Intermediate⏱ 120 min
Most analysis time goes into cleaning. A CRM export has names in capitals, phone numbers in four formats, dates stored as text and cities with extra spaces. Every report built on that data inherits its errors. Excel has three quick tools for standardising data: Flash Fill, Text to Columns and text formulas. This lesson uses all three and ends with checks.
Case studyA messy customer list
A sales operations team receives a list of 200 customers from a partner. Names are in one column, phone numbers are mixed, cities have stray spaces and the join date is text. The CRM import rejects the file. The task is to fix it in under an hour, and to show the steps so the next import can be repeated.
Flash Fill: learn the pattern from one example
Flash Fill watches what you type and fills the rest of the column when it spots a pattern. Type the result for the first row, then start typing the second row. When Excel shows the grey preview of the remaining rows, press Enter. Or press Ctrl+E on a selected column.
Typical uses:
Split a full name into first and last names.
Join first name and last name with a space.
Pull a code out of a longer text, such as the three-letter city code from "BLR-2025-0042".
Reformat phone numbers into one pattern.
XFlash Fill example: names
A
B
C
1
Full name as received
First name (typed once)
Last name (typed once)
2
asha RAO
Asha
Rao
3
Vikram Singh
Vikram
Singh
4
PRIYA mehta
Priya
Mehta
Type the first and second rows yourself, then use Ctrl+E on the empty cells. Excel learns that the first word is the first name and the last word is the last name.
::::warn Flash Fill is a guess
Flash Fill infers a rule from your examples and applies it everywhere. If the data has mixed patterns, one unusual row can produce a wrong result without any error message. Always scan the output, and sort or filter to look at the unusual cases.
::::
Text to Columns: split one column into several
Text to Columns is for splitting a column in a fixed rule-based way. It is faster than formulas for one-off splits.
Select the column.
Go to Data > Text to Columns.
Choose Delimited (a comma, space, semicolon or other character) or Fixed width (positions).
Set the destination so that the original column is not overwritten by mistake.
Example: an address stored as "Plot 12, Indiranagar, Bengaluru, Karnataka" splits cleanly on commas. A product code "FUR-CH-10001234" splits on the hyphen into category, sub-category and number.
::::tip Keep the original
Text to Columns overwrites the column to the right when you press Finish. Copy the source column first, or set the destination cell to an empty column.
::::
Standardising case and spacing
Three functions fix most text problems:
Problem
Formula
Result from " rAVI kUMAR "
Extra spaces inside and at the ends
=TRIM(A2)
"rAVI kUMAR"
Consistent capitals
=PROPER(A2)
"Ravi Kumar"
Upper or lower case
=UPPER(A2), =LOWER(A2)
"RAVI KUMAR"
Combine them so that one formula cleans the value: =PROPER(TRIM(A2)). Nest TRIM inside PROPER so that the spaces are removed before the capitals are set.
XStandardise names and cities
A
B
C
D
E
1
Raw name
Raw city
Clean name
Clean city
Check
2
rAVI kUMAR
bengaluru
Ravi Kumar
Bengaluru
ok
3
PRIYA mehta
Mumbai
Priya Mehta
Mumbai
ok
4
sanjay Reddy
delhi
Sanjay Reddy
Delhi
ok
C2=PROPER(TRIM(A2))
D2=PROPER(TRIM(B2))
E2=IF(C2=PROPER(TRIM(A2)),"ok","check")
Each pattern is copied down/across to the other cells in its column.
PROPER capitalises the first letter of each word and lowers the rest, so "bengaluru" becomes "Bengaluru". For acronyms such as "IT" or "ID", PROPER gives "It" or "Id"; keep those in a lookup list and replace them afterwards.
::::note CLEAN() removes hidden characters
Text pasted from web pages can contain non-breaking spaces and line breaks that TRIM does not remove. Use =TRIM(CLEAN(SUBSTITUTE(A2,CHAR(160)," "))) when the data comes from a website or a PDF.
::::
Standardising phone numbers
Phone numbers from different sources arrive as "98450 12345", "+91-98450-12345" and "(080) 2345 6789". A standard form, such as ten digits, makes matching and de-duplication reliable.
Step 1 removes the common separators with nested SUBSTITUTE:
Each pattern is copied down/across to the other cells in its column.
RIGHT(..., 10) keeps the last ten digits, which removes the country code. Check the results: a number with fewer than ten digits after cleaning is an error to review.
Converting text dates into real dates
A date stored as text, such as "15/03/2025" or "15-Mar-25", cannot be sorted or used in a timeline. Convert it with DATE (for numeric parts) or DATEVALUE (for recognised text), and check the result format.
XText dates to real dates
A
B
C
D
E
F
1
Text as received
Day
Month
Year
Real date
Days since joining
2
15/03/2025
15
3
2025
15-03-2025
606
3
01/11/2024
1
11
2024
01-11-2024
740
4
28/02/2025
28
2
2025
28-02-2025
621
B2=VALUE(LEFT(A2,2))
C2=VALUE(MID(A2,4,2))
D2=VALUE(RIGHT(A2,4))
E2=DATE(D2,C2,B2)
F2=TODAY()-E2
Each pattern is copied down/across to the other cells in its column.
Splitting the parts yourself is safer than relying on the locale. A text "03/04/2025" means different months in India and the United States; explicit day, month and year parts remove that doubt.
::::warn Locale changes date meaning
Excel reads "03/04/2025" as 3 April in a day-first locale and as 4 March in a month-first locale. Use explicit parts, as above, whenever the source format is not confirmed.
::::
Checking the clean data
Cleaning is not finished until you test it. Three simple checks catch most mistakes:
Count check: the number of rows before and after cleaning must match, unless you deliberately removed duplicates.
Blank check: =COUNTBLANK(range) should be zero for required columns.
Pattern check: =SUMPRODUCT(--(LEN(range)<>10)) counts phone numbers that are not ten characters.
For duplicates, use Data > Remove Duplicates on a copy, or =COUNTIF(range, A2)>1 to flag repeats before removing them.
XQuality flags on a cleaned list
A
B
C
D
1
Customer
Phone (clean)
Duplicate?
Phone ok?
2
Ravi Kumar
9845012345
duplicate
ok
3
Priya Mehta
9812345678
unique
ok
4
Ravi Kumar
98450
duplicate
check
C2=IF(COUNTIF(A$2:A$4,A2)>1,"duplicate","unique")
D2=IF(LEN(B2)=10,"ok","check")
C3=IF(COUNTIF(A$2:A$4,A3)>1,"duplicate","unique")
D3=IF(LEN(B3)=10,"ok","check")
C4=IF(COUNTIF(A$2:A$4,A4)>1,"duplicate","unique")
D4=IF(LEN(B4)=10,"ok","check")
The third row is flagged twice: its name repeats and its number is too short. Both are reasons to contact the partner before import.
A repeatable cleaning routine
Copy the raw data to a new sheet and never edit the original.
Trim, proper-case and remove hidden characters.
Split combined fields with Text to Columns or Flash Fill, checking each result.
Standardise phone numbers and dates with formulas, so the logic can be re-run.
Run the count, blank and pattern checks, and record what you found.
Save the final sheet with a date in the file name.
::::key What to remember
- Flash Fill (Ctrl+E) learns a pattern from examples and must be checked.
- Text to Columns splits by delimiter or position; copy the source first.
- PROPER(TRIM(...)) is the standard text clean-up; add CLEAN for pasted text.
- Standardise phone numbers and dates with formulas, using explicit date parts.
- Test the result with count, blank and pattern checks before import.
::::
Quick quiz5 questions · tap an answer to check it
1. Which shortcut runs Flash Fill on the selected column?
Answer: B. Ctrl+E is the Flash Fill shortcut.
2. What does =PROPER(TRIM(" rAVI kUMAR ")) return?
Answer: B. TRIM removes extra spaces, then PROPER capitalises each word.
3. Text to Columns overwrites which cells by default?
Answer: B. Choose an empty destination to keep the original data.
4. Why use explicit DATE(year, month, day) for text dates?
Answer: B. Explicit parts avoid day-month confusion.
5. Which formula counts rows whose required column is blank?
Answer: C. COUNTBLANK counts empty cells.
ExerciseClean a partner list
Using a sheet of 30 rows you create, with names in capitals, extra spaces, phone numbers in mixed formats and join dates as text in dd/mm/yyyy: (a) clean the names with PROPER(TRIM()); (b) produce a 10-digit phone column; (c) convert the dates to real dates; (d) add a flag column that marks duplicate names; (e) write a one-line summary showing how many rows failed the phone check.
Show solution
Hints: (a) =PROPER(TRIM(A2)). (b) nest SUBSTITUTE for "-", " ", "(" and ")", then =RIGHT(x,10). (c) =DATE(RIGHT(C2,4), MID(C2,4,2), LEFT(C2,2)). (d) =IF(COUNTIF(A$2:A$31,A2)>1,"duplicate","unique"). (e) =SUMPRODUCT(--(LEN(B2:B31)<>10)).
Practise more online
Free, trusted places to test yourself on this topic. Links open the original site in a new tab.