How to color a cell of a table using multirow and center the cell content?

You have to colour the cell in the first row, then put the content in the second row using

\multicolumn{1}{|c}{\multirow{-2}{*}{\cellcolor{blue!25} \textbf{C}}}  %% note -2

as in

\multicolumn{1}{c}{} & \multicolumn{1}{|c}{\multirow{2}{*}{\textbf{A}}}&\multicolumn{1}{|c}{\cellcolor{blue!25}} & \multicolumn{1}{|c}{\cellcolor{blue!25}}&  \multicolumn{1}{|c|}{}\\
\multicolumn{1}{c}{} & \multicolumn{1}{|c}{}& \multicolumn{1}{|c}{\multirow{-2}{*}{\cellcolor{blue!25} \textbf{B}}} & \multicolumn{1}{|c}{\multirow{-2}{*}{\cellcolor{blue!25} \textbf{C}}}& \multicolumn{1}{|c|}{\multirow{-2}{*}{\textbf{D}}} \\
\cline{1-5}

Full code:

\documentclass[journal]{IEEEtran}

\usepackage{tabularx}
\usepackage[dvips]{graphicx}
\usepackage{multirow}
\usepackage[skip=5pt]{caption}   % Unifies the distance between caption and float
\usepackage{array}
\usepackage[table]{xcolor}% http://ctan.org/pkg/xcolor
%\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}   %% may be better to learn doing this
\begin{document}

\begin{table*}[ht]
%\arrayrulewidth=1% %% this is how you increase the thickness of rules
\centering\caption{\label{tab:grid} The Grid.}    %% don't use \center{...}
\scalebox{1}
{{
\begin{tabular}{|m{2.25cm} |m{3cm} |m{3cm} |m{3cm} |m{3cm}|}
\cline{2-5}\noalign{\vspace{0.4pt}}     %% add this space and adjust suitably
\multicolumn{1}{c}{} & \multicolumn{1}{|c}{\multirow{2}{*}{\textbf{A}}}&\multicolumn{1}{|c}{\cellcolor{blue!25}} & \multicolumn{1}{|c}{\cellcolor{blue!25}}&  \multicolumn{1}{|c|}{}\\
\multicolumn{1}{c}{} & \multicolumn{1}{|c}{}& \multicolumn{1}{|c}{\multirow{-2}{*}{\cellcolor{blue!25} \textbf{B}}} & \multicolumn{1}{|c}{\multirow{-2}{*}{\cellcolor{blue!25} \textbf{C}}}& \multicolumn{1}{|c|}{\multirow{-2}{*}{\textbf{D}}} \\
\cline{1-5}
\multicolumn{1}{|c}{\multirow{2}{*}{\textbf{D}} }& \multicolumn{1}{|c}{\multirow{4}{*}{A/CD}} & \multicolumn{1}{|c}{\multirow{4}{*}{B/CD}} &  \multicolumn{2}{|c|}{\multirow{4}{*}{CD}}   \\
\multicolumn{1}{|c}{}&\multicolumn{1}{|c}{}&\multicolumn{1}{|c}{}& \multicolumn{2}{|c|}{}   \\
\cline{1-1}
\multicolumn{1}{|c}{\multirow{2}{*}{\textbf{C}}} &\multicolumn{1}{|c}{} &\multicolumn{1}{|c}{}& \multicolumn{2}{|c|}{}  \\
\multicolumn{1}{|c}{}&\multicolumn{1}{|c}{}&\multicolumn{1}{|c}{}& \multicolumn{2}{|c|}{}   \\
\cline{1-5}
\end{tabular}
}}
\end{table*}

\end{document}

enter image description here


With hhline, colortbl and makecell it is possible — and the syntax is a bit simpler:

\documentclass{article}

\usepackage{tabularx}
\usepackage[dvips]{graphicx}
\usepackage{multirow}
\usepackage[skip=5pt]{caption} % Unifies the distance between caption and float
\usepackage{array}
\usepackage{colortbl}
\usepackage[table]{xcolor}% http://ctan.org/pkg/xcolor

\usepackage{hhline}
\usepackage{makecell}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{\Gape[6pt]}

\begin{document}

\begin{table}[!ht]
\centering
\caption{\label{tab:grid} The Grid.}
  \begin{tabular}{|m{.4cm}| *{2}{m{0.9cm}|}*{2}{m{0.45cm}|}}
  \hhline{~|-|-|-|-|}
 \multicolumn{1}{c|}{} & \thead{A} & \cellcolor{blue!25}\thead{B}&\cellcolor{blue!25} \thead{C} & \thead{D} \\
\hline
\multirowthead{1}[10pt]{D} & \multirowcell{2}{A/CD} & \multirowcell{2}{B/CD} & \multicolumn{2}{c|}{\multirowcell{2}{CD}}\\[-13pt]%
\cline{1-1}
\thead{C} & & &\multicolumn{2}{c|}{} \\
\hline
  \end{tabular}
\end{table}

\end{document} 

enter image description here


Rather than multirow, here' a stacking alternative.

\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\usepackage{xcolor}
\def\xfrbox(#1,#2)#3{\fboxsep=-.5\fboxrule%
  \fbox{\makebox(#1,#2){#3}}\kern-\fboxrule}
\def\cfrbox#1(#2,#3)#4{\fboxsep=-.5\fboxrule%
  \fbox{\fboxsep=0pt\colorbox{#1}{\makebox(#2,#3){#4}}}\kern-\fboxrule}
\begin{document}
\begin{table}[ht]
\setlength\unitlength{1mm}%
\setstackgap{S}{-\fboxrule}
\centering
\caption{The Grid.}\medskip
\Shortstack{\xfrbox(6,6){\bfseries D}\\\xfrbox(6,6){\bfseries C}}%
\Shortstack{\xfrbox(12,6){\bfseries A}\\\xfrbox(12,12){A/CD}}%
\Shortstack{\cfrbox{blue!30}(12,6){\bfseries B}\\\xfrbox(12,12){B/CD}}%
\Shortstack{\cfrbox{blue!30}(6,6){\bfseries C}\xfrbox(6,6){\bfseries D}\\\xfrbox(12,12){CD}}%
\end{table}
\end{document}

enter image description here