Sub topic 13
Flash Fill for pattern-based entry
Flash Fill fills a column by recognizing a pattern in an example you type. It does not use formulas. It writes plain values, so the results do not change when the source data changes.
This chapter assumes you can enter text and formulas, use the fill handle, and select ranges. It builds on the fill handle and fill series chapters.
How Flash Fill works
You type the result you want in the first cell next to your data. Excel compares your example with the neighboring columns, infers the rule, and offers to fill the rest of the column. You can accept the suggestion or ignore it.
Suppose column A holds full names and you want first names in column B.
A2: Maria Lopez
B2: MariaStart typing the second example in B3. A grayed preview of the whole column appears. Press Enter to accept it.
Ways to start Flash Fill
- Type the first example and press Enter. Start the second and accept the preview with Enter.
- Press Ctrl+E in the cell below your example.
- Choose Data > Flash Fill on the ribbon.
- Choose Home > Fill > Flash Fill.
- Drag the fill handle down, then open the Auto Fill Options button and choose Flash Fill.
What it can do
| Task | Source | Example you type | Result |
|---|---|---|---|
| Extract first name | Maria Lopez | Maria | Maria |
| Extract last name | Maria Lopez | Lopez | Lopez |
| Combine parts | Maria and Lopez in two cells | Lopez, Maria | Lopez, Maria |
| Change case | maria lopez | Maria Lopez | Maria Lopez |
| Reformat numbers | 5551234567 | 555-123-4567 | 555-123-4567 |
Combining parts works because Flash Fill can read several columns at once.
Flash Fill or a formula
Flash Fill is quick, but its output is static. Compare it with a formula.
Formula in B2: =LEFT(A2,FIND(" ",A2)-1)If you edit A2, the formula result updates. A Flash Fill result stays as it was. Use a formula when the source data will change. Use Flash Fill for a one-time cleanup.
Common errors
- No preview appears. Flash Fill needs an adjacent column with data, and your example must be next to it with no blank column between. Check that Flash Fill is turned on under File > Options > Advanced > Automatically Flash Fill.
- Wrong results. Excel guessed a different rule than you intended. Fix the first wrong cell, then press Ctrl+E again to give it another example.
- Inconsistent data. Names with middle initials or missing parts can break the pattern. Clean up or give examples that cover those cases.
- Leading zeros disappear. Numbers such as 00123 may be read as numbers. Format the target column as Text before filling.
Exercise
Exercise
Column A contains the email addresses [email protected] and [email protected]. You want column B to contain only the part before the @ sign, and the addresses will never change. How would you do it with Flash Fill, and why might a formula be better if the addresses will change?
Show answer
Type ana.kim in B2. Select B3 and press Ctrl+E (or start typing raj.patel and press Enter to accept the preview). Flash Fill fills the column with the text before the @ sign. Flash Fill writes static values, so if an address in column A is edited, column B does not update. A formula such as =LEFT(A2,FIND("@",A2)-1) recalculates when A2 changes.