How can I draw a vertical line in a table cell?
An overkill TikZ solution; the common value is vertically centered as required:
\documentclass{article}
\usepackage{multirow}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand\tikzmark[1]{\tikz[remember picture,overlay] \node (#1) {};}
\begin{document}
\noindent\begin{tabular}{cccc}
column 1a &\tikzmark{a}\multirow{4}{*}{\tikzmark{c}50\tikzmark{d}} & column 3a & column 4a \\
column 1b & & column 3b & column 4b \\
column 1c & & column 3c & column 4c \\
column 1d &\tikzmark{b} & column 3d & column 4d \\
\end{tabular}
\tikz[remember picture,overlay]
{
\draw let \p1=( $ (c)!0.5!(d) $ ) in ([yshift=9pt]\x1,\y1) -- ([yshift=3pt]\p1|-a.north);
\draw let \p1=( $ (c)!0.5!(d) $ ) in ([yshift=-2pt]\x1,\y1) -- (\p1|-b);
}
\end{document}
In a comment, JLDiaz has proposed the following simplification not requiring the use of \multirow
and drawing the line with the value in a single step:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand\tikzmark[1]{\tikz[remember picture,overlay] \coordinate (#1);}
\begin{document}
\noindent\begin{tabular}{cccc}
column 1a &\tikzmark{a} & column 3a & column 4a \\
column 1b & & column 3b & column 4b \\
column 1c & & column 3c & column 4c \\
column 1d &\tikzmark{b} & column 3d & column 4d \\
\end{tabular}
\tikz[remember picture,overlay]
{\draw ([yshift=1ex]a) -- (b) node[midway,fill=white] {50};}
\end{document}
Here's an example which achieves the effect by create faux columns in which a multicolumn
command will be called.
Here's MWE.
\documentclass{article}
\begin{document}
Create faux columns 2 and 3.
The hspaces in the first line are to make the centering work correctly.
\begin{tabular}[t]{cc|ccc}%
1a & \hspace*{1em} & \hspace*{1em} & 3 & 4 \\
1b & & & 3 & 4 \\
1c & \multicolumn{2}{c}{value} & 3 & 4 \\
1d & & & 3 & 4 \\
\end{tabular}
\end{document}
Is this what you're looking for?