Query Mixed Data Types: Why Values Go Blank and 2 Clear Fixes

Query mixed data types and the formula quietly keeps one type per column, blanking the rest. Google Sheets QUERY assigns one type to each input column. Values of a minority type are treated as null, so a text copy count such as '3 can disappear even though it looks like the number 3 in the sheet. A separate setting, the third argument, tells QUERY how many rows at the top of its input are headers. If that count is wrong, the first detail row can be read as a heading, or a heading can be read as data. Google’s QUERY function reference explains the headers argument.

query mixed data types at a glance

These two faults can produce the same symptom: a planner insert is marked Ready in the source, but it never reaches the print queue. Diagnose query mixed data types in the report before changing print settings. A duplex test can catch an upside-down reverse; it can’t catch a monthly insert that the report never sent to print.

Isolate the fault: query mixed data types or the header row?

  1. Start the input range at the actual column headings. If row 1 says April planner print queue and row 2 contains Insert, Size and Copies, start at A2, not A1. Set the third argument to 1 for a range beginning at row 2, or 0 for a range beginning at the first detail row. The count is relative to the input range, not the sheet.

  2. To test for query mixed data types, run a diagnostic query without a filter. Use =QUERY(A2:E8,"select A,C,D",1) to show the insert name, copy count and batch ID. Leave out where, group by and limit until the detail rows make sense. If Monthly appears but its source count of 3 is blank, you have a different fault from a report that loses the entire Monthly row.

  3. Check the stored values in the affected column. Test =ISNUMBER(C7) and =ISTEXT(C7) in spare cells. A typed 3 and a pasted '3 can have the same appearance while returning opposite results. Changing the number format to Number won’t convert text already stored in the cell. Check the same test against a value that the query kept, such as C3.

  4. Set a type for each field according to its job, which stops query mixed data types at the source. Copies must be numbers because the report compares and adds them. Batch IDs should be text if a leading zero or a prefix carries meaning. Put converted values in helper columns so you can compare the report inputs against the source without overwriting an imported batch ID.

  5. Restore the filters and reconcile the queue. Add the size and status criteria first, then the positive copy count condition. Record both the number of matching source rows and the number cleared for print. If five A5 rows are marked Ready but only four have a valid count, the fifth row belongs on an exception list, even if the query is now working as intended.

When more than one condition is involved, the guide to building a live report with SELECT, WHERE and ORDER BY shows how the clauses fit together. For fault finding, add them back one at a time so you can identify which clause removes a record.

What the blank cell really means

What the blank cell really means

Google Sheets determines a QUERY column’s type from the majority type in the input. If four copy counts are numbers and two are text, you have query mixed data types, and the text values become null. That applies to both TBD and a text numeral such as '3. With query mixed data types, the formula doesn’t judge which text looks convertible.

A filter such as where C > 0 makes the problem less visible. In a simple select A,C, the insert name can still appear beside a blank count. With the numeric filter in place, that row fails the condition and disappears. If new imports change which type is in the majority, query mixed data types can make a previously working report change behaviour without anyone editing its formula.

The header argument works on a different part of the input. With A2:E8, a value of 2 marks rows 2 and 3 as headers, so the first insert isn’t available as a detail record. A value of 0 puts the cells in row 2 into the data instead. Leaving the argument out, or setting it to -1, asks Sheets to guess. Use an explicit count for a print queue that receives recurring imports.

The query’s label clause controls output headings. It can rename F to Copies, but it can’t bring back a detail row consumed by the header count or turn a text numeral into a number. Likewise, a formula such as =IFERROR(QUERY(...),"") won’t help with query mixed data types, where the query runs without an error and returns an incomplete queue.

Repair an A5 planner insert queue from source to print

Repair an A5 planner insert queue from source to print

Suppose the Inserts tab has a title in row 1 and these field names in row 2. The six records occupy A3:E8. In this example, the apostrophe marks values entered as text in Sheets; it doesn’t appear in the displayed cell.

RowA: InsertB: SizeC: CopiesD: Batch IDE: Status
3WeeklyA52101Ready
4NotesA54102Ready
5Habit trackerA5TBDA-03Ready
6DividerPersonal1104Hold
7MonthlyA5'3'00105Ready
8Meal planA52106Ready

Confirm what the old report leaves out

Run =QUERY(Inserts!A2:E8,"select A,C,D",1) on the report tab. The six names should be available. The habit tracker and monthly rows have nulls in the queried copy count and batch ID columns because both fields are numeric in the majority of source rows.

Now add where B = 'A5' and E = 'Ready' and C > 0. The report returns Weekly, Notes and Meal plan, for eight copies. The habit tracker should stay out of the print run until someone supplies a quantity. Monthly is the real loss: its three copies were specified, but the report couldn’t use the stored text value.

Separate copy quantities from batch identifiers to avoid query mixed data types

On Inserts, put Print copies in F2 and Print batch ID in G2. Enter this formula in F3 and fill it down to F8:

=IF(REGEXMATCH(TRIM(C3&""),"^[0-9]+$"),VALUE(TRIM(C3&"")),"")

This template accepts a string of digits after trimming ordinary spaces, then returns a number. In the sample it turns the text 3 into numeric 3, leaves TBD without a count and keeps 4 numeric. It doesn’t treat 3 sets or 2.5 as a quantity. A zero can pass this conversion step, but it won’t pass the print query’s > 0 condition.

In G3, use =IF(D3="","",TO_TEXT(D3)) and fill down. This keeps A-03 and the stored text 00105, while making numeric batch IDs such as 101 available to the query as text. If 00105 was already imported as plain numeric 105, don’t expect the helper to know which zeros were lost. Recover the ID from its source or apply a documented padding rule if every ID in that series has a fixed width.

Build the queue and account for the held row

Run the print queue from the corrected fields:

=QUERY(Inserts!A2:G8,
 "select A,B,F,G
  where B = 'A5' and E = 'Ready' and F > 0
  order by G
  label F 'Copies', G 'Batch ID'",
 1)

The repaired queue has four rows and 11 copies. Monthly comes first because 00105 sorts before 101 as text. If the assembly workflow needs a different order, give it a separate numeric sequence column. Don’t convert identifiers to numbers to make the order look right.

To reconcile the queue, count source rows matching A5 and Ready with COUNTIFS, then compare that count with the same criteria plus F > 0:

=COUNTIFS(Inserts!B3:B8,"A5",Inserts!E3:E8,"Ready")
=COUNTIFS(Inserts!B3:B8,"A5",Inserts!E3:E8,"Ready",Inserts!F3:F8,">0")

The counts are five and four. Record the difference as Habit tracker: quantity required, rather than replacing TBD with zero or assuming one copy. The Personal divider is outside this A5 run by design. If the report also needs a total by insert size or batch, summarise the corrected records with GROUP BY and PIVOT, keeping the detail queue for picking and assembly.

Turn the reconciled queue into a print and assembly run

  1. Match each queue row to its file and print setup. Pair the Monthly row and batch 00105 with the approved A5 PDF. Keep size, copy count, simplex or duplex setting, and file version with the print instructions. The queue has 11 insert copies, not necessarily 11 sheets. Three copies of a four-page PDF use six leaves if printed duplex with one page per side.

  2. Print one complete test set before running the batch. For a PDF built at A5, check the preview against the intended paper and start with Actual size or 100% if the design is meant to print at its supplied dimensions. If you’re printing two A5 pages on A4 for trimming, use a layout designed to place both pages on the sheet. A driver’s two-pages-per-sheet setting can shrink the artwork. Measure a known feature on the test sheet, such as a 100 mm guide, before cutting the batch.

  3. Check the reverse after trimming and punching the test. Mark the top edge of the first sheet in pencil. Turn the page as it will turn in the planner and verify that the reverse reads upright and the binding margin sits against the rings or discs. If the reverse is inverted, test the other duplex flip setting. The right choice depends on page orientation and how the pages sit on the print sheet.

  4. Collate in planner order and count assembled sets. A queue sorted by batch ID is useful for identifying files, but its first row needn’t be the first page behind the cover. Lay the trimmed inserts out in planner order, verify the front and back of each design, then count finished sets against the copy quantities. Keep the habit tracker on hold until its source row has an approved count.

Fix the faults that return on the next import

A new import brings back blank copy counts

Check the first and last rows of the new data against the formula range. In the worked example, A2:G8 stops at row 8, so a new row 9 won’t appear at all. If you extend the query range, extend the helper formulas too, or query mixed data types will creep back in. A row inside the query range with no formula in F still fails F > 0. A fixed range suits a closed batch; a queue that grows needs a range and helper setup that grow together.

A heading appears halfway through the detail rows

Look for files pasted one under another with each file’s header still in place. The query’s header count only covers rows at the top of the selected range. It won’t identify a second Insert | Size | Copies row further down. Strip repeated headings and subtotal lines on the import tab rather than relying on F > 0 to hide everything that isn’t a print record.

A batch filter misses an ID with leading zeros

Check the field on both sides of the filter. If G contains the text ID 00105, the query comparison is where G = '00105'. If a selector cell holds the number 105, it can’t supply those leading zeros by itself. Set up the selector from the text batch IDs and follow the same distinction when passing a date or a user-selected criterion into a query: text identifiers and date values need different query syntax.

Release the print run only when every Ready row for the selected size appears either in the queue or on a named hold list, and the trimmed duplex test fits the planner. For this batch, that means 11 copies across four designs, with Habit tracker held for a quantity. If the counts don’t reconcile, fix the report before sending the batch to the printer.

Scroll to Top