# LATEX : save the value of a cell in Tabular

This question may seem very simple but I didn't find a solution!

I have a table with some values. Among these values, I want to save some of them to re-use them in a table that summarizes few tables.

How can I save the values which are in the cell to be able to re-use them later ?

Thanks a lot !

PS: With spreadtab, I cannot customize the columns as I defined them.

\documentclass[a4paper, 12pt]{report}

\begin{document}
\begin{tabular}{ccc}
1 & 2 & 3 \\
4 & 5 & 6 % I will re-use the values 5 and 6 later
\end{tabular}

\begin{tabular}{ccc}
7 & 8 & 9 \\
10 & 11 & 12 % I will re-use the values 11 and 12 later
\end{tabular}

%Summary table
\begin{tabular}{cc}
5 & 6 \\
11 & 12
\end{tabular}
\end{document}

• Welcome to TeX.SE. Could you put please your complete minimal compilable code? – Sebastiano Oct 11 at 10:45
• Ok, it's done :-) – Flora Grappelli Oct 11 at 11:33

An approach could be to save each element to be reused in a variable. In this case, you can easily change the value only at one place.

\documentclass[a4paper, 12pt]{report}

\newcommand{\myvarA}{5}
\newcommand{\myvarB}{6}
\newcommand{\myvarC}{11}
\newcommand{\myvarD}{12}

\begin{document}
\begin{tabular}{ccc}
1 & 2 & 3 \\
4 & \myvarA & \myvarB % I will re-use the values 5 and 6 later
\end{tabular}

\begin{tabular}{ccc}
7 & 8 & 9 \\
10 & \myvarC & \myvarD % I will re-use the values 11 and 12 later
\end{tabular}

%Summary table
\begin{tabular}{cc}
\myvarA & \myvarB \\
\myvarC & \myvarD
\end{tabular}
\end{document}