I would like to change the first column into three columns, such that I can write three numbers in each row instead of only one. Everything else should stay the same.

\documentclass{article}
\usepackage{tabularx}
\usepackage{caption}
\usepackage{showframe}

\begin{document}
\begin{table}
\centering
\renewcommand{\tabularxcolumn}[1]{>{\centering\arraybackslash}p{#1}}
\begin{tabularx}{\textwidth}{|c|*4{X|}}
\hline
& \multicolumn{2}{c|}{\thead{here a longer text is written}}
& \multicolumn{2}{c|}{\thead{here also a longer text is written}} \\
\cline{2-5}
\thead{A\\number} & left & right & left & right \\
\hline
1 & X & X & X & X\\
2 & X & X & X & X\\
3 & X & X & X & X\\
4 & X & X & X & X\\
\hline
\end{tabularx}
\end{table}
\end{document}

• Three numbers stacked? If so, what should the alignment be with respect to the other X-columns? If they should be horizontally spread instead, do you require alignment across the rows? Do you have any restrictions/requirements in terms of the input? Perhaps you can provide an image of the expected output you're after. – Werner Nov 15 '18 at 19:21

\documentclass{article}
\usepackage{tabularx}
\usepackage{caption}
\usepackage{showframe}

\begin{document}
\begin{table}
\centering
\renewcommand{\tabularxcolumn}[1]{>{\centering\arraybackslash}p{#1}}
\begin{tabularx}{\textwidth}{|*{3}{c|}*{4}{X|}}
\hline
\multicolumn{3}{|c|}{}
&\multicolumn{2}{c|}{\thead{here a longer text\\ is written}}
& \multicolumn{2}{c|}{\thead{here also a longer\\ text is written}}
\\
\cline{4-7}