Sub topic 14
Flash Fill for pattern-based entry
Flash Fill fills a column by copying a pattern you show it with one or two examples. This chapter assumes you can enter and commit data, use the fill handle, and know the difference between a stored value and a displayed value.
What Flash Fill does
Flash Fill watches what you type next to a column of existing data. It compares your entry with the neighboring cells and looks for a rule, such as "take the first word" or "join these two columns with a space." When it finds one, it offers to fill the rest of the column.
Flash Fill writes plain values. It does not write formulas, so the results do not update when the source data changes. This is the main difference from a formula such as =TEXT(A1,"00000"), which recalculates.
A worked example
Suppose column A holds full names and you want first names in column B.
- In A2 to A5, enter
Ana Lopez,Ben Carter,Chen Wei, andDara Singh. - In B2, type
Anaand press Enter. Excel moves to B3. - In B3, start typing
Ben. A gray preview of the remaining rows appears. - Press Enter to accept the preview.
If no preview appears, you can run Flash Fill by hand. Select B3 and press Ctrl+E. You can also choose Data, then Flash Fill.
What patterns it can learn
| Task | Example typed | Result for the next row |
|---|---|---|
| Extract the first word | `Ana` from `Ana Lopez` | `Ben` |
| Join two columns | `Lopez, Ana` | `Carter, Ben` |
| Change case | `ANA LOPEZ` | `BEN CARTER` |
| Extract part of a code | `472` from `AB-472-X` | The middle part of each code |
| Add fixed text | `ID: 00123` | `ID: ` plus the next value |
Flash Fill works best when the source data is consistent. It must be in the columns next to the one you are filling, and there must be no blank column between them.
Common errors
- No preview appears. Excel could not find a pattern. Type a second example, or check that the source columns are adjacent.
- Wrong results for some rows. Excel guessed a rule that fits your examples but not every row. This happens when names have middle names or extra spaces. Press Esc, then add an example for the awkward case.
- Results go stale. Flash Fill output is static. If A2 changes, B2 does not. Use a formula when the source will change.
- Numbers lose their leading zeros. Flash Fill can turn
00123into the number 123. Format the target column as Text before filling, or type the example with an apostrophe, as in'00123. - The option is off. Go to File, Options, Advanced, and check that Automatically Flash Fill is selected.
When to use it
Use Flash Fill for a one-time cleanup of data that will not change. Use a formula when the source data will be edited later, because the formula will keep the result in sync.
Exercise
Column A contains AB-472-X, CD-815-Y, and EF-209-Z. You type 472 in B2, but Flash Fill fills B3 with an unexpected value. What two actions can you take, and why would you choose a formula instead if the codes in column A change often?
Show answer
Press Esc to reject the preview, then type a second example, 815 in B3, so Excel can see the rule. Or run Ctrl+E again after correcting the examples. A formula is better for changing data because Flash Fill output is static and will not update when column A changes.