FxFormula Drills

Premium Google Sheets drill · Sheets scenarios

Clean a name column

Practice a Google Sheets cleanup column that uses ARRAYFORMULA, TRIM, and REGEXREPLACE to fix spaced names.

A2:A4 are names with extra spaces. In Sheets, TRIM removes spaces at the ends and leaves spaces between words alone.

In C2, use ARRAYFORMULA to trim each name and then replace runs of spaces with a single space.

Dataset

Starter sheet. Cells marked formula are where the formula goes.

Starter sheet for this exercise
RowABC
1Raw nameClean name
2 Ada LovelaceFormula goes in C2. formula
3Grace Hopper
4Alan Turing

Hint

REGEXREPLACE can turn one or more spaces into one space. The pattern is a space followed by +.

Explanation

TRIM drops the spaces around Ada, and REGEXREPLACE collapses the double spaces inside the names. Grace Hopper is already a single space, so it stays as it is.

The interactive sheet and a worked solution are part of Formula Drills Premium. The instructions and starter data on this page are the full problem.

Solve this drill

Practice this formula

Loading the practice grid…

Google Sheets is a trademark of Google LLC. Formula Drills is not affiliated with Google. Excel drills on this site are a separate track.