Sub topic 2
Preparing your data: a clean header row and consistent columns
A table is only as reliable as the range it comes from. Google Sheets reads your range, decides where the headers are, and guesses a type for each column. If the range is messy, those guesses are wrong, and you spend time fixing them afterward. This chapter covers how to prepare a range so the conversion works the first time.
Prerequisites
This chapter assumes you can do the following:
- Navigate Google Sheets and select ranges of cells, rows, and columns.
- Enter data and write simple formulas such as
SUM. - Read A1 notation, for example
C2:C4.
The previous chapter compared plain ranges with tables. This chapter does not convert anything yet. The next chapter covers the conversion steps.
What a conversion-ready range looks like
A range converts cleanly when it follows five rules:
- The first row holds one header per column.
- Every header is unique and non-empty.
- Each column holds one kind of data.
- There are no blank rows or blank columns inside the data.
- There are no merged cells.
The sample below follows all five rules.
Order ID | Customer | Order Date | Amount | Paid
1001 | Acme | 2026-01-05 | 250 | TRUE
1002 | Globex | 2026-01-09 | 480 | FALSE
1003 | Initech | 2026-01-12 | 125 | TRUEThe header row names five columns. The first column holds identifiers, the second holds names, the third holds dates, the fourth holds numbers, and the fifth holds checkbox values. No row is empty and no cell spans two columns.
The header row
The header row becomes the labels at the top of the table. Those labels also become the column names you use in formulas, such as Orders[Amount]. A good header is easier to work with later, so spend a minute on each one.
Rules for headers
- Use one row. A two-line header, where one row holds a group name and the next holds a field name, does not work. Combine them into one label, such as
Q1 Revenue. - Make each header unique. Two columns both called
Amountare ambiguous in a formula. Rename them, for exampleAmount NetandAmount Gross. - Fill every header cell. A blank header leaves a column without a name. Give it a short label.
- Keep headers as text. A header that looks like a number or a date, such as
2026, can be treated as data. Add a word, such asFY2026, or put the value in a text format. - Keep them short. Short names make formulas easier to read and type.
Naming style
Pick one naming style and use it throughout. Order Date, OrderDate, and order_date all work, but mixing them in one table makes formulas harder to remember. Spaces are allowed in column names. Avoid special characters such as brackets, quotation marks, and #. These characters can clash with the syntax that formulas use to refer to columns.
Consistent columns
Each column in a table has a type, and the type is what makes a column predictable. A date column can sort chronologically. A number column can be summed. A checkbox column can be counted. These behaviors only work when every value in the column is the same kind.
Common inconsistencies
| Problem | Example | Effect | Fix |
|---|---|---|---|
| Numbers stored as text | `'250` or `250 ` with a trailing space | Left-aligned, ignored by `SUM` | Remove the apostrophe or space, then reapply a number format |
| Mixed date formats | `2026-01-05` and `Jan 5` and `5/1/26` | Some entries do not sort as dates | Reenter or convert them to one format |
| Units inside the cell | `250 USD` | The cell is text, not a number | Move the unit into the header and keep only the number |
| Text in a number column | `n/a` or `pending` | Sums and averages skip the value | Leave the cell empty or use a separate status column |
| Inconsistent labels | `Acme`, `ACME`, `Acme Inc.` | Filters list the same customer three times | Standardize the spelling |
| Mixed booleans | `TRUE`, `yes`, `1` | Counts miss some rows | Use checkboxes or `TRUE` and `FALSE` only |
How to spot the problems
Several quick checks show whether a column is consistent:
- Look at alignment. By default, numbers and dates align right, and text aligns left. A left-aligned value inside a column of right-aligned numbers is probably text.
- Use a type test. In a spare cell, enter
=ISNUMBER(D2)and fill it down. AnyFALSEmarks a value that is not a real number. - Compare counts. Select the column and read the status bar at the bottom right. Compare the count of numeric values with the count of non-empty cells. A gap means some cells are not numeric.
- Use a filter. Turn on a filter and open the dropdown for the column. The list of distinct values shows spelling variants, stray blanks, and unexpected entries.
The following formula flags every row in column D that is not a true number. Enter it in a spare cell outside your data, then delete it when you finish.
=ARRAYFORMULA(IF(D2:D4="", "", NOT(ISNUMBER(D2:D4))))A value of TRUE in the result marks a cell that needs attention. Extend the range to cover your real data.
Fixing text that should be numbers
Numbers stored as text are the most common problem, especially after you paste data from a web page or import a CSV file. To repair them:
- Select the column.
- Choose Format, then Number, then Automatic or Number.
- Look for values that stay left-aligned.
- For those values, remove leading apostrophes, spaces, and non-breaking spaces.
If trailing spaces are the cause, a helper column can clean them. Put this formula beside the data, copy the results, and paste them back as values only.
=VALUE(TRIM(D2))TRIM removes extra spaces, and VALUE turns the cleaned text into a number. Paste with Edit, Paste special, Values only, so the formula does not stay in the cell.
Blank rows, blank columns, and merged cells
Sheets uses blank rows and columns as boundaries when it guesses the extent of your data. A blank row in the middle of a range can split it into two regions, and the conversion may include only the part above the gap.
Blank rows and columns
- Delete empty rows inside the data. Right-click the row number and choose Delete row.
- Delete empty columns for the same reason.
- Rows at the very end that look empty may still hold spaces or formatting. Select them and use Delete rows rather than only pressing the Delete key.
An empty cell inside a row is fine. A single missing value in the Amount column does not break the table. The rule concerns whole rows and whole columns that are empty.
Merged cells
Merged cells combine several cells into one. A table needs each cell to belong to exactly one row and one column, so merged cells conflict with that structure. To remove them:
- Select the range that contains merged cells.
- Choose Format, then Merge cells, then Unmerge.
- Fill in the cells that were hidden by the merge. Unmerging keeps the value only in the top-left cell, so the rest are empty.
A common case is a label such as a region name that spans several rows. After unmerging, repeat the label in each row so that every row is complete. A filter or sort needs the label in every row to keep records together.
Totals, notes, and other extras
Many working sheets include content that does not belong in the table body. Separate it before you convert.
- Total rows. A
SUMrow at the bottom of the data counts as a record. It will be sorted and filtered along with the real rows. Move totals above the data, to another sheet, or into a cell outside the range. - Title rows. A title above the headers means the header is not the first row. Either move the title outside the range or leave a blank row between the title and the headers, and select only the header and data when you convert.
- Notes in adjacent cells. Text in the column next to the data can be pulled into the range. Leave an empty column between the table and any notes, or move the notes elsewhere.
- Formulas that sum the range. A formula such as
=SUM(C2:C4)refers to fixed cells. It does not grow when new rows appear below row 4, unless you edit it. The next chapters show how to replace it with a name such as=SUM(Orders[Amount]).
Formulas inside the range
Formulas are allowed inside a table, but they need to be consistent. If a column holds a formula, it should use the same formula in every row.
- Use the same pattern in each row. A formula such as
=C2*D2in row 2 and=C3*D3in row 3 is consistent, because each row refers to its own cells. - Avoid hardcoded values in some rows. A typed number among formulas looks like part of the pattern but does not update. It is a common source of wrong totals.
- Avoid references to cells outside the range that shift. Anchor them with
$, as in$G$1, if they should stay fixed.
A calculated column that mixes formulas and typed values is hard to spot by eye. Click through a few rows, or use Edit, Find and replace with Search in formulas to review them.
A preparation checklist
Before converting, run through this list:
- Select the whole range and confirm it is a rectangle with a header row on top.
- Check that each header is filled in, unique, and short.
- Scan each column for mixed types, using alignment,
ISNUMBER, or a filter. - Delete blank rows and columns inside the data.
- Unmerge cells and fill in the gaps.
- Move totals, titles, and notes outside the range.
- Check that formula columns use the same formula in every row.
- Save a copy, or note the current version in version history.
Worked example: cleaning a messy range
Suppose you have the following data. It has two problems: the Amount column holds a value with a unit, and a blank row splits the data.
Order ID | Customer | Order Date | Amount | Paid
1001 | Acme | 2026-01-05 | 250 | TRUE
1002 | Globex | 2026-01-09 | 480 USD | FALSE
| | | |
1003 | Initech | 2026-01-12 | 125 | TRUETake these steps:
- Right-click the blank row number and choose Delete row. This closes the gap, so the data forms one block.
- Click the
Amountcell that holds480 USD. Replace it with480. - Rename the header from
AmounttoAmount (USD)only if you need the unit. Otherwise keepAmount, which is shorter and works better in formulas. - In a spare cell, enter
=ARRAYFORMULA(NOT(ISNUMBER(D2:D4))). Every result should beFALSE. Delete the spare cell afterward.
After these edits, the range matches the clean sample at the start of this chapter. It is ready for conversion.
Edge cases
- Dates that look right but are text. A value such as
2026-01-05can be a real date or a text string. Check alignment, or use=ISDATE(C2). Reapply a date format through Format, Number, Date if the test fails. - Leading zeros. Identifiers such as
00123lose their zeros if stored as numbers. Format the column as Plain text before entering them. - Checkboxes in a mixed column. A column that holds some checkboxes and some typed
TRUEvalues may behave inconsistently. Insert checkboxes for the whole column through Insert, Checkbox. - Hidden rows and columns. Hidden rows still belong to the range. Unhide them to review what the table will include.
- Very wide ranges. A range with many columns is easier to check if you freeze the header row through View, Freeze, 1 row.
Exercise
A range has headers in row 1: Region, Sales, Sales, and an empty header cell in column D. Column B holds numbers, but a few cells are left-aligned. Row 20 is blank, and rows 21 to 30 hold more records. Name the problems, and say what you would do to fix each one before converting.
Show answer
There are five problems. (1) The two Sales headers are duplicates, so rename them to distinct names such as Sales Q1 and Sales Q2. (2) The empty header in column D leaves that column unnamed, so enter a short label. (3) The left-aligned cells in column B are probably numbers stored as text, so remove stray apostrophes or spaces, then reapply a number format and confirm with ISNUMBER. (4) The blank row 20 splits the data, so delete it so rows 21 to 30 join the rest. (5) If any region labels are merged across rows, unmerge them and repeat the label in every row.
Exercise
Why is a total row at the bottom of a range a problem when you convert it to a table, and where can you put the total instead?
Show answer
The table treats every row in its body as a record, so the total row would be sorted, filtered, and counted along with the data. Put the total in a cell outside the range, such as above the table or on a separate sheet, and calculate it with a formula that refers to the column, for example =SUM(Orders[Amount]) once the table is named.