After using tex.stackexchange.com/a/373987/134144, I have some code that will make a table that spans multiple pages and displays the page count at the top of each table. The issue that I am having is I do not want the page count if the table does not in fact cover multiple pages. For instance, if the table starts at the top of the page and can fit on the page it starts on, the page count should not be included. If the same table instead starts, say, halfway down the page, and would spill over onto a new page, then I want the page count to appear. This is what I have so far but I am not sure on how to only have something appear if and only if the table spans multiple pages.
\documentclass{article}
\usepackage{booktabs,supertabular}
\usepackage{lastpage}
\usepackage[table]{xcolor}
\begin{document}
\tablehead{
\multicolumn{2}{l}{\textbf{Table 1.1 (Sheet~\thepage~of~\pageref{LastPage})}}\\
\hline\multicolumn{1}{c|}{\cellcolor{gray!25}\textbf{Foo}} &
\multicolumn{1}{|c}{\cellcolor{gray!25}\textbf{Bar}}\\
\hline }
\tablefirsthead{
\multicolumn{2}{l}{\textbf{Table 1.1 (Sheet~\thepage~of~\pageref{LastPage})}}\\
\hline\multicolumn{1}{c|}{\cellcolor{gray!25}\textbf{Foo}} &
\multicolumn{1}{|c}{\cellcolor{gray!25}\textbf{Bar}}\\
\hline }
\tabletail{\hline}
\tablelasttail{\hline}
\begin{supertabular}{l|l}
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
Lorem Ipsum & John Doe \\[5pt] \hline
\end{supertabular}
\end{document}