Fill a column by example with Flash Fill
Clean up messy data8 min
A recruiting coordinator in Atlanta exports 300 candidates from the hiring system, written last name first: Whitfield, Dana. The interview letters need the names the usual way round, and she doesn't want to write a formula for a one-off list.
How it works
Flash Fill looks at what you typed in the column beside your data, works out how each example was built from the cells to its left, and fills the rest of the column the same way.
- In the empty column next to the data, type the result for the first row, such as Dana Whitfield.
- Select the next cell down and press CtrlE, on Windows and on a Mac, or choose Data > Flash Fill. With Automatically Flash Fill switched on in Excel's options, Excel may show the rest as a preview while you type the second example, and Enter accepts it.
- Check the results. Where a row came out wrong, give Flash Fill a second example from a row like that one, and it looks for a pattern that fits both.
It handles patterns such as first names, initials, email domains, the middle part of a code and names turned round. It struggles when the rows don't follow one pattern, such as a list where some people have a middle name.
What it writes are plain values. Change a name in column A and its result stays as it was, and new rows need another Flash Fill. For a list that keeps changing, a formula such as TEXTAFTER follows the source.
Example
- Step 1: Type the result for the first row, Dana Whitfield.
- Step 2: Select
B3and press CtrlE. Flash Fill finds howB2was built fromA2. - Step 3: It writes the same pattern down to the last row of the list, as values.
Common mistakes
- Trusting the column without a look. One unusual row, such as a two-part last name, can come out wrong while the rest look fine. Check the shortest and the longest results.
- An example that fits two patterns. From Lee Ann Park, the result Park could be the third word or the last one. Type a second example from a row where those differ, such as a name with two words.
- Expecting the results to update. They're values, so run Flash Fill again after the source changes, or use a formula.
In short
- Type one result, then CtrlE or Data > Flash Fill fills the rest of the column.
- Give it a second example where it guesses wrong.
- Flash Fill writes values that never update. Use a formula for data that changes.
Practice
4 exercises · free, no account needed