# Formatting a table with multiple headers using tabular like this?

I'm trying to set up a bunch of tables using the tabular package to summarise data at the end of my thesis. I've been trying to use examples given here to get what I'm envisioning, but I'm having difficulty.

The basic template I want to create looks like this:

I can't workout the following:

1. How do I make the "time interval" have two rows while the two remaining columns are split into 2 rows as shown.

2. How do I split the table first into 3 collumns and then 5 to get the effect shown.

My attempt at this has just given me butchered tables which make no sense, so I don't have any good example code to give.

• Welcome to TeX.SE! Please show us the code you have tried so far! Then it is much more easier to help you and we have not to gues what you did so far. And we do not have to create a test table ;-) – Mensch Oct 26 '17 at 2:40
• I added my attempt, but I'm really unhappy with it and don't think it will be of much help. – Patty Oct 26 '17 at 2:50
• @JohnKormylo how do I use multirow and multicollumn at the same time to get what I want? Not sure how to format that. – Patty Oct 26 '17 at 2:54
• I'm not sure what are are trying to do. The image says one thing and the MWE something else entirely. – John Kormylo Oct 26 '17 at 2:57
• MWE? The example code I gave is garbage, it's not achieved what I want. That's why I didn't want to give it. I want to get what's in the picture I drew. – Patty Oct 26 '17 at 2:59

## 2 Answers

For something as simple as this, you don't really need multirow.

\documentclass{standalone}
\begin{document}
\begin{tabular}{|l|c|c|c|c|}
\hline
\multicolumn{5}{|c|}{January 2010 Results} \\
\hline
\multicolumn{1}{|c|}{Trade} & \multicolumn{2}{c|}{A} & \multicolumn{2}{c|}{B}\\
\cline{2-5}
\multicolumn{1}{|c|}{Interval} & T & C & T & C \\
\hline
Afghanistan   & AF    &AFG&AFG&AFG\\
Aland Islands&   AX  & ALA&AFG&AFG   \\
Albania &AL & ALB&AFG&AFG\\
Algeria    &DZ & DZA&AFG&AFG\\
American Samoa&   AS  & ASM&AFG&AFG\\
Andorra& AD  & AND&AFG&AFG   \\
Angola& AO  & AGO&AFG&AFG\\
\hline
\end{tabular}
\end{document}


• Edit: Nevermind, got it working. Thanks a lot! – Patty Oct 26 '17 at 3:15

I agree with John that multirow isn't really necessary here, but it's a nice tool to have at your disposal. The code with multirow looks like this:

\documentclass{article}
\usepackage{multirow}

\begin{document}

\begin{tabular}{|c|c|c|c|c|} \hline
\multicolumn{5}{|c|}{Title}\\ \hline
\multirow{2}{*}{\begin{tabular}{c}Time\\Interval\end{tabular}} & \multicolumn{2}{c|}{A} & \multicolumn{2}{c|}{B}\\ \cline{2-5}
& C & T & C & T \\ \hline
& & & & \\
& & & & \\
& & & & \\
& & & & \\ \hline
\end{tabular}

\end{document}


Note the multirow entry of Time Interval is created as a nested table so that the two words are center-justified and the line break is forced. There are other ways to do this.