How to Fix “Missing Number, Treated as Zero” with \multirow
At a glance
- 1. Check the arguments
In \multirow, the first argument is the number of rows to span; the second is the cell width.
- 2. Put the star in width
Use \multirow{2}{*}{Text} when you want LaTeX to choose the cell width automatically.
- 3. Check the table
Load the multirow package and leave the corresponding cells empty in the rows covered by the merged cell.
The message “Missing number, treated as zero” often appears in a table when \multirow receives its arguments in the wrong order. In particular, LaTeX expects a number of rows as the first argument; an asterisk in that position triggers the error.
For an automatically sized cell spanning two rows, write \multirow{2}{*}{Text}. The * belongs in the width argument, not the row-count argument.
Use the correct argument order
The basic command is:
\multirow{number of rows}{width}{text}
For example, \multirow{2}{*}{Group A} spans two rows. The first argument, 2, says how many rows the cell covers. The second argument, *, tells the package to use the natural width of the text.
This is the incorrect order:
\multirow{*}{2}{Group A}
Here the first argument is *, but LaTeX needs a row count there. It tries to read a number, encounters the asterisk, and reports the missing-number error. Swap the arguments:
\multirow{2}{*}{Group A}
Minimal working example
The multirow package provides \multirow. This complete example creates a cell that spans two rows:
\documentclass{article}
\usepackage{multirow}
\begin{document}
\begin{tabular}{|c|c|}
\hline
\multirow{2}{*}{Group A} & First row \\
\cline{2-2}
& Second row \\
\hline
\end{tabular}
\end{document}
In the second row, the first-column entry is left blank because the Group A cell already occupies that position across both rows. \cline{2-2} draws a horizontal rule only below the second column; a full-width \hline there would run through the multirow cell.
If the error remains
Check the command and nearby table syntax in this order:
- Inspect the first argument. It should be a row count, such as
2, not*or text. - Check the braces. A missing or misplaced brace can shift the arguments, making LaTeX read the wrong material as the row count.
- Confirm the package is loaded. Put
\usepackage{multirow}in the preamble. If the command were simply undefined, LaTeX would generally report an undefined-control-sequence error instead, but loading the package is still required. - Check the table row endings. Separate rows with
\\, and use&to separate columns. An extra&or a missing\\can cause a different alignment error nearby.
Common mistakes
- Putting the width star first:
\multirow{*}{2}{Text}is wrong; use\multirow{2}{*}{Text}. - Confusing row count and width: the first argument controls how many rows the cell spans; the second controls its width. A width can be
*or a dimension such as2cm. - Filling the covered cells again: for a two-row span, leave the corresponding cell blank in the next row rather than entering another value in that same column.
If you intentionally need a fixed-width cell, keep the same argument order and specify a dimension, for example \multirow{2}{2cm}{Group A}.
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.