Sub topic 11
Replacing formulas with cleaned values
This chapter assumes you can enter and copy formulas, understand relative references such as A2, and know the difference between text and numbers in a cell. It also assumes you have a helper column that holds a cleaning formula, such as =PROPER(TRIM(CLEAN(SUBSTITUTE(A2,CHAR(160)," ")))).
Why the formulas must go
A helper column gives you clean text, but each cell still depends on the original column. That causes three problems:
- If you delete the original column, the helper cells show
#REF!. - If you sort or move the original data, the helper results can change or point to the wrong rows.
- Other people who receive the file get formulas they did not ask for, and the sheet recalculates more than it needs to.
The fix is to turn the formula results into static values. A static value is the text itself, with no formula behind it.
Steps to convert formulas to values
- Select the helper column cells that contain the formulas, for example B2:B500.
- Press Ctrl+C to copy them.
- With the same cells still selected, open Paste Special. On Windows, press Ctrl+Alt+V, or use Home, then Paste, then Paste Values.
- Choose Values and click OK.
- Press Esc to clear the copy outline.
Click one of the cells afterward. The formula bar should show text, not a formula. Only then is it safe to change the original column.
Pasting over the original column
You can also paste the values back over the original data, so the cleaned text replaces the messy text in place:
- Copy the helper column B2:B500.
- Select the first cell of the original column, A2.
- Use Paste Special and choose Values.
- Delete the helper column.
This works because pasting values does not create references. Do not use a normal paste here. A normal paste copies the formulas, and they would then point at the cells you just overwrote, which creates a circular reference.
Check the result before you finish
Compare a few rows against the originals. Useful checks are:
- Filter or sort the column and look for rows that are still wrong.
- Test a lookup against another table and confirm that values now match.
- Use
=LEN(A2)on a few cells to confirm that no extra characters remain.
If something is still wrong, you may have hidden characters that the formula did not target. Return to the diagnosis steps from the earlier chapters before pasting again.
Common errors
| Symptom | Likely cause | What to do |
|---|---|---|
| `#REF!` after deleting column A | The formulas were not converted first | Undo with Ctrl+Z, then paste values |
| Values vanish or turn to zeros | You pasted over cells that the formulas referred to, using a normal paste | Undo, then use Paste Values |
| Cleaned numbers still left-aligned | They are text, not numbers | See the next chapter on numbers that stay text |
| Formatting changed | Paste Values keeps the source's displayed text but not its formulas, and the destination's formats may differ | Use Paste Special with Values and number formats if needed |
A quick example
Suppose A2 contains jOHN sMITH with a stray trailing space. In B2 you enter:
=PROPER(TRIM(CLEAN(A2)))B2 shows John Smith. Fill the formula down the column, copy B2:B500, then paste values into B2:B500. Now B2 holds the plain text John Smith, and you can delete column A without any error.
Exercise
You cleaned names in B2:B200 with a formula and want the cleaned text to replace the original names in A2:A200. List the steps in order, and say what goes wrong if you use a normal paste instead of Paste Values.
Show answer
Copy B2:B200, select A2, use Paste Special and choose Values, then delete column B. A normal paste copies the formulas, which would refer to cells in column A that were just overwritten. This creates circular references and the results become wrong or zero.
Exercise
After pasting values, you click a cell and the formula bar still shows a formula. What does this tell you, and what should you do?
Show answer
The paste did not convert that cell. Copy the cell again and use Paste Special with Values, then check the formula bar once more.