How do I right-align certain cells in a (booktabs) table?

Using \multicolumn you can override the column specification for a particular cell:

\documentclass{article}
\usepackage{booktabs}
\usepackage[table]{xcolor}

\begin{document}

\begin{table}
  \centering
    \caption{A comparison of statistics for forest and trailside ash saplings}
    \begin{tabular}{lll}
    \toprule 
    Statistic & Forest & Trailside \\ \midrule
        \rowcolor[gray]{.9} Sample size (trees)       & 243 & 257\\
        Mean (mm)               & 133.19 & 139.39 \\ 
        \rowcolor[gray]{.9} Median (mm)   & 93   & 100\\ 
        Standard deviation (mm) & 110.36  & 117.96 \\ 
        \rowcolor[gray]{.9} Standard error (mm)    & 7.08   & 7.36\\
    95\% Confidence intervals (mm) &  ~ & ~ \\
    \multicolumn{1}{r}{Upper bound} & 147.07 & 153.81 \\
    \multicolumn{1}{r}{Lower bound} & 119.31 & 124.96 \\
    \bottomrule
    \end{tabular}
\end{table}

\end{document}

enter image description here

I would also suggest you to use \centering instead of the center environment to avoid adding extra vertical spacing.


You can use

\multicolumn{1}{r}{Upper bound}

I suggest you to look at the siunitx package that provides an S column type for correctly output numerical data in tables.


Your table needs very little additional tweaking to achieve your objectives, I believe. In the MWE below, I use the siunitx package (and its column type "S") to align the numbers on the decimal point, as well as the \multicolumn command. Happy TeXing!

\documentclass{article}
\usepackage{booktabs}
\usepackage[table]{xcolor}
\usepackage{siunitx}
\begin{document}
\begin{table}
\centering
\caption{A comparison of statistics for forest and trailside ash saplings}
\smallskip
\sisetup{table-format = 3.2}
\begin{tabular}{lSS}
\toprule 
Statistic & \multicolumn{1}{l}{Forest} & \multicolumn{1}{l}{Trailside} \\ 
\midrule
\rowcolor[gray]{.9} 
Sample size (trees) & 243 & 257\\
Mean (mm)           & 133.19 & 139.39 \\ 
\rowcolor[gray]{.9} Median (mm)  & 93  & 100 \\ 
Standard deviation (mm)          & 110.36  & 117.96 \\ 
\rowcolor[gray]{.9} Standard error (mm)  & 7.08 & 7.36   \\
95\% Confidence intervals (mm) &  ~ & ~ \\
\multicolumn{1}{r}{Upper bound} & 147.07 & 153.81 \\
\multicolumn{1}{r}{Lower bound} & 119.31 & 124.96 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}

enter image description here