# [Tex/LaTex] How to make table cells that span more than one column or row

multicolumntables

I tried this code but the border lines are not deleted:

\begin{tabular}{|p{0.6in}|p{0.3in}|p{0.9in}|p{0.9in}|p{0.8in}|} \hline
&                                                   &  & $P_{mot}$ &  \\ \hline
$P_{batt}$ &  & S & M & H \\ \hline
& S & S & Z & VS \\ \hline
SOC & M & M & Z & H \\ \hline
& H & M & Z & H \\ \hline
\end{tabular}


How do I delete the border of cells?

Welcome to TeX.SE! In order to merge rows or columns, you need to use \multirow (which requires the multirow package) or \multicolumn, respectively. And if you nest them, you need to do it in the right order.

\documentclass{article}
\usepackage{multirow}
\begin{document}
\begin{tabular}{|p{0.6in}|p{0.3in}|p{0.9in}|p{0.9in}|p{0.8in}|} \hline
\multicolumn{2}{|c|}{\multirow{2}{*}{$P_\mathrm{batt}$}} &
\multicolumn{3}{|c|}{$P_\mathrm{mot}$ }  \\ \cline{3-5}
\multicolumn{2}{|c|}{}   & S & M & H \\ \cline{1-5}
\multirow{3}{*}{SOC} & S & S & Z & VS \\ \cline{2-5}
& M & M & Z & H \\ \cline{2-5}
& H & M & Z & H \\ \hline
\end{tabular}
\end{document}