Sub topic 2
Laying out your data so it charts cleanly
This chapter assumes you can move around Google Sheets, enter and format data, select ranges, and use simple formulas such as SUM. You do not need to have inserted a chart yet. That comes in the next chapter. Here you will learn how to arrange a table so that Google Sheets reads it the way you intend.
Why layout comes first
Google Sheets does not know what your numbers mean. When you insert a chart, it guesses which cells are headers, which column holds categories, and which columns hold series. It makes these guesses from the shape of your data. A clean layout makes the guess correct. A messy layout makes you repair the chart by hand in the chart editor, and some problems cannot be repaired there at all.
Most chart errors come from the source table, not the chart tool. If you fix the table, the chart usually fixes itself.
The standard layout: one header row, one label column
The layout that works best for most charts is a rectangular block:
- The first row holds a short text header for each column.
- The first column holds the category labels, such as months, regions, or product names.
- Every other column is one series, meaning one set of values that becomes a line, a set of bars, or a set of slices.
- Each row below the header is one category.
Here is a small example.
| Month | North | South | West |
|---|---|---|---|
| Jan | 120 | 95 | 80 |
| Feb | 135 | 102 | 91 |
| Mar | 150 | 98 | 110 |
When you chart this block, Sheets treats Month as the label column and creates three series named North, South, and West. Each series has one value per month.
Rows or columns: which direction are the series?
Sheets can read a table in either direction. In the layout above, each column is a series. If your data is turned the other way, with months across the top and regions down the side, each row is a series.
Sheets picks a direction by looking at the shape of the data. When you select a range, it usually puts the series along the shorter dimension, because a table with few columns and many rows is typically a list of records. This is a heuristic, and it can be wrong. If your chart comes out with the series and categories swapped, you do not need to rebuild the table. The chart editor has a switch rows and columns option, which you will meet in the chapter on the data range and series. Knowing the default behaviour tells you when to expect the swap.
A useful rule is to keep the number of series small and the number of categories larger. Three series across twelve months reads well. Twelve series across three months usually does not.
Headers: text on top, numbers below
Sheets decides whether the first row is a header by checking whether its values look different from the rows beneath. A row of text above rows of numbers is detected as a header. Problems appear when the check is ambiguous.
- Year headers. If your column headers are
2023,2024,2025typed as numbers, Sheets may see them as data and plot them as a series. Store them as text by typing them with a leading apostrophe ('2024) or by formatting the cells as plain text before typing. - Blank header cells. A column with no header gets a generic name, and a blank cell above the label column can confuse header detection. Give every column a header, including the label column.
- Duplicate headers. Two columns both called
Salesproduce two series with identical legend entries. Make each header unique, for exampleSales 2024andSales 2025. - Multi-row headers. A header that spans two rows, such as a group name above a sub-name, is not read as one header. Use a single row and combine the words, for example
North Q1.
Keep headers short. They become legend entries and axis titles, so a long header crowds the chart.
Keep numbers as numbers
A chart can only plot a cell as a number if Sheets stores it as a number. Values that look numeric but are stored as text are plotted as zero or skipped. Typical causes:
- A currency symbol or unit typed into the cell as plain text, such as
$1,200imported from another system, or45 kg. - Numbers pasted from a web page or PDF with hidden spaces.
- A leading apostrophe on the value.
- Values left-aligned in the cell when you expected right-aligned numbers.
Left alignment is a quick check. By default Sheets right-aligns numbers and left-aligns text. If a column of figures sits against the left edge, it is probably text.
To convert a text column in a new helper column, use VALUE and SUBSTITUTE:
=VALUE(SUBSTITUTE(SUBSTITUTE(B2, "$", ""), ",", ""))Use number formatting, not typed symbols, to show units. Format the column as currency or a custom format such as 0 "kg", and the cell stays a real number that displays the unit.
Dates as the category axis
Dates need a real date value, not text that looks like a date. When the label column contains true dates, Sheets can treat the horizontal axis as a continuous time axis. Gaps between dates are then spaced in proportion to elapsed time, so a missing month shows as a longer stretch of line. When the same dates are text, each label gets equal spacing and the chart misleads you about timing.
To check a date, change its format to a number. A true date becomes a serial number such as 45292. Text stays unchanged.
Sort dates in ascending order before charting. Line charts connect points in row order for text labels, so an unsorted column draws a line that jumps backward.
Blanks, totals, and stray cells
Empty cells and extra rows change what a chart shows.
- Blank rows or columns inside a table can split it. Sheets may treat the data above and below the gap as separate ranges, or stop at the first blank row when you click inside the table.
- Blank values inside a series become gaps. Line charts break the line at a blank. Whether you want a gap or a zero is a decision to make, and you can enter
0or leave the cell empty accordingly. - Total rows and total columns are a common mistake. If you select a block that includes a
Totalrow, the total is charted as another category, and its large value flattens every other bar. Keep totals outside the charted range, or select only the data rows. - Notes, comments, and subtotal lines placed inside the block are read as data. Move them away from the table.
Leave one empty row or column between your chart data and any other content on the sheet.
Wide and long data
Two layouts describe the same facts differently.
| Layout | Shape | Good for |
|---|---|---|
| Wide | One row per category, one column per series | Charting directly |
| Long | One row per observation, with columns such as Date, Region, Sales | Storing, filtering, and summarising |
Long data is how most exports arrive, and it is a good form for storage. It does not chart as separate series without reshaping, because all the sales values sit in one column. To turn long data into a wide table, use a pivot table or a QUERY formula. The following formula builds a summary of total sales per value in column A for the North region, and it updates when the source rows change:
=QUERY(A1:C100, "select A, sum(C) where B = 'North' group by A label sum(C) 'Sales'", 1)The final 1 tells QUERY that the data has one header row. The result is a tidy two-column block that you can chart directly. Later chapters cover pivot-based and formula-driven charts in more detail.
Seeing the layout as a flow
The diagram below summarises the checks to make before inserting a chart.
Common errors at a glance
| Symptom | Likely cause in the data | Fix |
|---|---|---|
| A year column appears as a line | Years stored as numbers | Store years as text |
| A bar is missing or zero | Value stored as text | Convert to a number |
| One huge bar dwarfs the others | Total row included | Exclude the total |
| Line jumps backward | Dates unsorted | Sort ascending |
| Two legend entries share a name | Duplicate headers | Rename headers |
| Series and categories swapped | Sheets guessed the direction wrongly | Switch rows and columns later |
Exercise
A table has the headers 2023, 2024, and 2025 typed as numbers in B1:D1, with regions in A2:A5 and sales figures below. When you chart A1:D5, Sheets draws "2023", "2024", and "2025" as an extra data series instead of using them as headers. Give two ways to fix the table so the chart reads correctly.
Show answer
Convert the year headers to text so Sheets does not read them as data. For example, retype them with a leading apostrophe ('2023) or format B1:D1 as plain text and retype them. Alternatively, rename the headers so they are clearly text, such as FY2023, FY2024, and FY2025. Either way, the first row then looks different from the numeric rows below it and is detected as a header.
Exercise
A column of sales figures was pasted from another system and sits against the left edge of its cells. A chart of the column shows zero-height bars. What is the cause, and how can you fix it without retyping each value?
Show answer
The values are stored as text, which is why they are left-aligned and plotted as zero. Remove stray symbols and spaces and convert them to numbers in a helper column with a formula such as =VALUE(SUBSTITUTE(SUBSTITUTE(B2, "$", ""), ",", "")), then chart the helper column. Show units with number formatting rather than typing them into the cell.