I would like to make a table like the one in the following screenshot. I could use \multicolumn to create the second row with S1,S2 etc. In the next stage i couldn't split the cells for 'V' and 'I'. 
3 Answers
The less vertical rules in a table, the better. If we accept this axiom, then zero is the right number of vertical rules. They serve no purpose and are simply a hindrance to reading.
Also horizontal rules should be used sparingly, mainly to separate chunks of rows that are linked together. Shifting a cell's content vertically is not needed: a blank cell in the table body means “repeat the value above”.
So here's my proposal for the table, that's quite similar to Svend Tveskæg, but differs from it in the placement of the row headers.
Note that \cmidrule(lr) is used for making clear how the groups of columns should be interpreted.
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\begin{tabular}{*{16}{l}}
\toprule
\multicolumn{2}{c}{Data1} & \multicolumn{14}{c}{Data2} \\
\cmidrule(lr){3-16}
&& \multicolumn{2}{c}{S1} & \multicolumn{2}{c}{S2}
& \multicolumn{2}{c}{S3} & \multicolumn{2}{c}{S4}
& \multicolumn{2}{c}{S5} & \multicolumn{2}{c}{S6}
& \multicolumn{2}{c}{S7} \\
\cmidrule(lr){3-4}\cmidrule(lr){5-6}\cmidrule(lr){7-8}\cmidrule(lr){9-10}
\cmidrule(lr){11-12}\cmidrule(lr){13-14}\cmidrule(lr){15-16}
&& V & I & V & I & V & I & V & I & V & I & V & I & V & I \\
\midrule
Subdata1 & Try1 &&&&&&&&&&&&&& \\
& Try2 &&&&&&&&&&&&&& \\
\midrule
Subdata2 & Try1 &&&&&&&&&&&&&& \\
& Try2 &&&&&&&&&&&&&& \\
\midrule
Subdata3 & Try1 &&&&&&&&&&&&&& \\
& Try2 &&&&&&&&&&&&&& \\
\bottomrule
\end{tabular}
\end{table}
\end{document}

- 1,121,712
Here is how I would do it (with suggestions from egreg incorporated):
\documentclass{article}
\usepackage[hmargin = 3cm]{geometry} % to avoid `overfull \hbox' warning
\usepackage{booktabs,multirow,makecell}
\def\mc#1#2{\multicolumn{#1}{c}{#2}}
\def\mr[#1]#2#3{\multirowcell{#2}[#1]{#3}}
\begin{document}
\begin{table}
\setlength\tabcolsep{9pt}
\centering
\begin{tabular}{*{16}{l}}
\toprule
\mc{2}{Data1}
& \mc{14}{Data2} \\
\cmidrule{3-16}
&& \mc{2}{S1}
& \mc{2}{S2}
& \mc{2}{S3}
& \mc{2}{S4}
& \mc{2}{S5}
& \mc{2}{S6}
& \mc{2}{S7} \\
\cmidrule(lr){3-4}
\cmidrule(lr){5-6}
\cmidrule(lr){7-8}
\cmidrule(lr){9-10}
\cmidrule(lr){11-12}
\cmidrule(lr){13-14}
\cmidrule(lr){15-16}
&& V & I & V & I & V & I & V & I & V & I & V & I & V & I \\
\midrule
\mr[-0.5ex]{2}{Subdata1} & Try1 &&&&&&&&&&&&&& \\
\cmidrule(l){2-16}
& Try2 &&&&&&&&&&&&&& \\
\midrule
\mr[-0.5ex]{2}{Subdata2} & Try1 &&&&&&&&&&&&&& \\
\cmidrule(l){2-16}
& Try2 &&&&&&&&&&&&&& \\
\midrule
\mr[-0.5ex]{2}{Subdata3} & Try1 &&&&&&&&&&&&&& \\
\cmidrule(l){2-16}
& Try2 &&&&&&&&&&&&&& \\
\midrule
& &&&&&&&&&&&&&& \\
\cmidrule(l){2-16}
& &&&&&&&&&&&&&& \\
\bottomrule
\end{tabular}
\end{table}
\end{document}

Notice the absence of any vertical lines; they often disturb more than they help.
- 31,033
-
1I'd align “Data1” with ”Data2”; also there's no need of vertically centering “SubdataX” if you use a
\cmidrule, which however should be trimmed on the left with\cmidrule(l){2-16}. Depending on the data, the\cmidrulecould be unneeded. – egreg Jan 01 '15 at 16:46 -
@egreg I've change the alignment and added
(l)but I don't understand why I don't need to vertically center “SubdataX” if I use\cmidrule(l){2-16}. If you will change the code (and possibly the screenshot) regarding this, that would be nice. – Svend Tveskæg Jan 01 '15 at 17:02 -
1Here is a picture of how I'd do it. There's no need to vertically center any cell; it's clear that “Subdata1” refers to both rows. Note also the seven
\cmidrulecommands in the header. – egreg Jan 01 '15 at 17:12
You don't need to think of split cells, but could merge different amounts of cells. As you already know about \multicolumn and its syntax is pretty basic, here is the way for producing the first three rows with different merging.
- I generate a row with all simple cells
- I made a row with merged 2-cells
- I inserted the row with the merged 14-cell
- I took care to preserve the desired lines by also adding them to the multicolumn format specifications
\documentclass{article}
\renewcommand*{\familydefault}{\sfdefault}
\renewcommand*{\arraystretch}{1.5}
\begin{document}
\begin{tabular}{|l|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
\multicolumn{2}{|l|}{Data1} & \multicolumn{14}{c|}{Data 2} \\
\cline{3-16}
\multicolumn{2}{|c|}{} & \multicolumn{2}{l|}{S1} & \multicolumn{2}{l|}{S2}
& \multicolumn{2}{l|}{S3} & \multicolumn{2}{l|}{S4}
& \multicolumn{2}{l|}{S5} & \multicolumn{2}{l|}{S5}
& \multicolumn{2}{l|}{S7} \\
\cline{3-16}
\multicolumn{2}{|c|}{} & V & I & V & I & & & & & & & & & & \\
\hline
\end{tabular}
\end{document}
Follow the "Linked" and "Related" links on the right side to learn more about merging.
Final remark: consider not using so much lines. Such a grid may be helpful for entering data later, if intended, otherwise it could be harder to read.
- 31,033
- 231,401
Vs andIs as a column pattern ant to merge columns withS1and so on in the previous verse. – Przemysław Scherwentke Dec 23 '14 at 07:47