How to make a table with multiple rows and colums

I want to make this following table:

This is the code I was trying to do but it's already not working and I am having difficulties figuring out how to do those multicolumns in combination with those multirows

\begin{landscape}
\begin{table}[ht]
\centering
\begin{small}
\begin{tabular}{|l|l|l|l|l|l|}
\hline
& \multicolumn{8} {c|}{} & {\bfseries  Age} &{\bfseries Gender}  & {\bfseries Education}\\
\cline{2-4}
& Mean & SD& Male &Female & SD & Male&High school &Undergraduate& Master or higher&Other\\
\hline
\end{tabular}
\end{table}
\end{landscape}


• The posted screenshot shows a table with 11 columns, you're specifying only 6 and try to use \multicolumn{8}{....} -- how should this work? None of the l column type specifiers will give wrapping in the cells as is apparently needed in Master degree or higher. And of course, the post is a fragment only, missing the underlying document and the packages – user31729 Aug 13 '16 at 10:20

To change the texsize, you can use \tiny, \small or other sizes. No need to use environments for this here, as the table-environment would group the fontsize to only that table, and not effect the rest of your document. Other fontsizes, along with some information about them can be found in the post What point (pt) font size are \Large etc.?

When creating multiple columns of the same type, it is easier to write *{11}{l}instead of lllllllllll, and it is much easier to read it. You can of course combine the methods and write c*{4}{l}rr.

Note that I have not input the numbers as represented in your image, I just copied the first line.

I would advice against using a table this way. I'd try to make it less wide, so that it doesn't have as much white space and could be typeset in portrait mode, remove vertical lines, possible split that data into multiple tables. Mico also suggests a differemt fontsize, along with reduced spacing between columns, and I agree. I have made these suggestions into an example. Further improvements could be made of course.

Code without suggestions

\documentclass[11pt]{article}
\usepackage{lscape}
\usepackage{multirow}
\begin{document}
\begin{landscape}
\begin{table}[ht]
\centering
\tiny
\begin{tabular}{*{11}{|l}|}
\hline
\multicolumn{3}{|c|}{} & \multicolumn{2}{c|}{\bfseries  Age} &\multicolumn{2}{c|}{\bfseries  Gender}  & \multicolumn{4}{|c|}{\bfseries  Education}\\
\cline{4-11}
\multicolumn{3}{|c|}{}& Mean & SD & Male & Female & High school & Undergraduate & Master or higher & Other\\
\cline{6-11}
\multicolumn{3}{|c|}{}&& & Count & Count & Count & Count & Count & Count\\
\hline
1st party & High information& Noticable & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
cookies & density & Non-noticable & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
\cline{2-11}
& \multirow{2}{*}{Low information density}& Noticable & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
&& Non-noticable & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
\hline
1st/3rd party& High information & Noticable & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
cookies & density & Non-noticable & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
\cline{2-11}
& \multirow{2}{*}{Low information density}& Noticable & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
&& Non-noticable & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
\hline
\end{tabular}
\end{table}
\end{landscape}
\end{document}


Suggested code

\documentclass[11pt]{article}
\usepackage{lscape}
\usepackage{multirow}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{threeparttable}

\newcommand{\minitab}[2][l]{\begin{tabular}{#1}#2\end{tabular}}

\begin{document}
\begin{table}[ht]
\centering
\setlength{\tabcolsep}{3pt}
\scriptsize

\begin{tablenotes}
\item Abbreviations: HS: Highschool, U: Undergratuate, M+: Master degree or higher
\end{tablenotes}

\begin{tabular}{*{3}{l}*{8}{c}}
\toprule
\cmidrule{4-11}
& && & & M & F & HS & U & M+ & O\\
\cmidrule{6-11}
\midrule
\multirow{4}{*}{\bfseries 1st party} & High & Yes & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
& & No & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
& Low & Yes & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
&& No & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
\hline
\multirow{4}{*}{\bfseries 1st/3rd party} & High & Yes & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
&  & No & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
& Low & Yes & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
&  & No & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
\bottomrule
\end{tabular}
\begin{tablenotes}
\item *Records may not be correct as it was reported that many students thought the survey was regarding consumable cookies, and not internet-cookies
\end{tablenotes}
\end{table}
\end{document}

• I updated the answer with some fixes. – Runar Aug 13 '16 at 10:53
• @Lana I made some suggestions on improvements. Your table should now fit within a standard page, and be a lot more readable. – Runar Aug 13 '16 at 12:04

I would reorganize the table so that the cells contain less repeated information and, instead, put that information in the table's header. I would also rearrange the header material to reduce the widths of the columns; this, in turn, will permit the use of a larger font size, which will be much appreciated by your readers. By the way, if the header is designed well, there's no need to use bold to draw attention to some of the header cells. Finally, I'd the table a more open look (by omitting all vertical bars and most horizontal bars).

\documentclass[11pt]{article}
\usepackage{rotating,booktabs}
\begin{document}
\begin{sidewaystable}[t!]
\centering
\small % no need for \tiny or \scripsize
\begin{tabular}{@{}l *{10}{c}@{}}
\toprule
Cookies & Information density & Noticeable? % ?
& \multicolumn{2}{c}{Age}
& \multicolumn{2}{c}{Gender (Count)}
& \multicolumn{4}{c@{}}{Education (Count)}\\
\cmidrule(lr){4-5} \cmidrule(lr){6-7} \cmidrule(l){8-11}
&& & Mean & SD & Male & Female
& High  & Under- & Master's  & Other\\
&&&&&&& school & graduate & or higher \\
\midrule
1st party
& High & Yes & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
&      & No  & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
& Low  & Yes & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
&      & No  & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
1st/3rd party
& High & Yes & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
&      & No  & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
& Low  & Yes & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
&      & No  & 35 & 12 & 12 & 17 & 9 & 11 & 9 & 0\\
\bottomrule
\end{tabular}
\end{sidewaystable}
\end{document}

• This is highly creative, I like it :) – Runar Aug 13 '16 at 12:31

Another variant, with some commands as shortcuts, and the makecell package. The font size is the more readable \footnotesize:

        \documentclass[11pt]{article}
\usepackage[showframe]{geometry} %
\usepackage{multirow, array, rotating, makecell, cellspace}
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}

\newcommand\HighInf{\makecell[lc]{High information\\ density}}
\newcommand\LowInf{\makecell[lc]{Low information\\ density}}
\newcommand\NonNot{\ensuremath{\biggl[\begin{tabular}{l@{}}Noticeable \\[0.5ex] Non-noticeable\end{tabular}}}

\begin{document}

\begin{sidewaystable}[!ht]
\centering
\setlength\tabcolsep{3.5pt}
\footnotesize
\begin{tabular}{|lcc*{8}{|Sc}|}
\hline
\multicolumn{3}{|c|}{} & \multicolumn{2}{Sc|}{\bfseries Age} &\multicolumn{2}{c|}{\bfseries Gender} & \multicolumn{4}{c|}{\bfseries Education}\\
\cline{4-11}
\multicolumn{3}{|c|}{}& Mean & SD & Male & Female & High school & \makecell{Undergraduate\\ level} & \makecell{Master degree\\ or higher} & Other\\
\cline{6-11}
\multicolumn{3}{|c|}{}&& & Count & Count & Count & Count & Count & Count\\
\hline
\makecell{1st party\\ cookies} & \HighInf & \NonNot & \makecell{35\\35} & \makecell{12\\12} & \makecell{12\\12} & \makecell{17\\17} & \makecell{9\\9} & \makecell{11\\11} & \makecell{9\\9} & \makecell{0\\0} \\[2ex]
& \LowInf & \NonNot & \makecell{35\\35} & \makecell{12\\12} & \makecell{12\\12} & \makecell{17\\17} & \makecell{9\\9} & \makecell{11\\11} & \makecell{9\\9} & \makecell{0\\0} \\%
& & & & & & & & & & \\[-2ex]
\hline & & & & & & & & & & \\[-2ex]
\makecell{1st/3rd party\\ cookies}& \HighInf & \NonNot & \makecell{35\\35} & \makecell{12\\12} & \makecell{12\\12} & \makecell{17\\17} & \makecell{9\\9} & \makecell{11\\11} & \makecell{9\\9} & \makecell{0\\0} \\
& \LowInf & \NonNot & \makecell{35\\35} & \makecell{12\\12} & \makecell{12\\12} & \makecell{17\\17} & \makecell{9\\9} & \makecell{11\\11} & \makecell{9\\9} & \makecell{0\\0} \\
\hline
\end{tabular}
\end{sidewaystable}

\end{document}
`