\multirow
command, needs to be act on its own column...
So you need to add an extra column on the left side in each column and thus an extra &
needed on each left side of every row of your table and an extra columntype (lets say c
) at the beginning of your tabular's arguments.
Also, multicolumn in your example will should be 3 rows tall and should start from the row (1,4,7). But then an \hline
on one of this or the next rows, would add a line in the "multirowed" cell too, and this is not wanted. So, we have to change some \hline
s with \cline{2-4}
that is a line from column 2 to column 4 and not from 1st to last.
Finally, you can add empty \multicolumn{1}{c|}{}
as first element of your first two rows, in order to change their behavior from |c|
to c|
and remove this way the unwanted vertical line from their left side:
\documentclass{article}
\usepackage{multirow}
\begin{document}
\begin{table}
\centering
\caption{Table}
\begin{tabular}{|c|c|c|l|} \cline{2-4}
\multicolumn{1}{c|}{}&\multicolumn{3}{|c|}{ ABC} \\ \cline{2-4}
\multicolumn{1}{c|}{}&A&B&C\\ \hline
\multirow{3}{*}{DEF}&1& 4 & 7 \\ \cline{2-4}
&2& 5 & 8 \\ \cline{2-4}
&3& 6 & 9 \\ \hline
\end{tabular}
\end{table}
\end{document}
PS: Tried to show you what was your mistakes and not to find a way to show your table more beautiful.
\begin{document}
. This will make it easier for us to help you