The solution of egreg is good. It typesets the cell content in a box which is then discarded. All code in the cell is executed and typeset. There are also two alternatives which I list here for the sake of completeness.
First you can use the collcell
package to collect the cell content and then feed it to a macro which simply discards it. The \@gobble
macro does that. This method doesn't execute or typeset the cell content but needs to scan every token. It might be faster or slower than the use of a box dependent on the content.
Another method is to insert a macro which reads everything till the next \unskip
which is inserted after each cell except the very last column of a row. There the \unskip
is inside \\
and won't be seen by the macro.
This method is the fastest and doesn't execute, typeset or check the cell content beside the argument scanning of the TeX parser.
For small cells the speed difference should be not important.
\documentclass[a4paper]{article}
\usepackage{collcell}
\makeatletter
\newcolumntype{G}{>{\collectcell\@gobble}c<{\endcollectcell}@{}}
\makeatother
% Fastest. Does not work in the last column.
\def\eatcell#1\unskip{}
\newcolumntype{E}{>{\eatcell}c@{}}
\begin{document}
\begin{tabular}{ccGc}
one & two & hide & three\\
1 & 2 & H & 3
\end{tabular}
\begin{tabular}{ccEc}
one & two & hide & three\\
1 & 2 & H & 3
\end{tabular}
\begin{tabular}{ccc}
one & two & three\\
1 & 2 & 3
\end{tabular}
\end{document}