I wanted to ask how I center the text in the description row (not in the rest of the table that will follow. This to reduce the space between the text and the \cmidrule
\documentclass[a4paper, 11pt]{article}
\usepackage[left=2cm,top=2cm,right=2cm, bottom=2cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{caption}
\usepackage{siunitx}
\usepackage{ragged2e}
\usepackage{booktabs, tabularx}
\newcolumntype{C}{>{\RaggedRight\hspace{0pt}\arraybackslash}X}
\newcolumntype{P}[1]{>{\RaggedRight\hspace{0pt}}p{#1}}
\newlength\colwidth
\usepackage{float}
\usepackage[version=4]{mhchem}
\begin{document}
\begin{table}[H]
\settowidth\colwidth{Solutionn}
\begin{tabularx}{\textwidth}{@{}P{\colwidth}* {7}{C} @{}}
\toprule
\textbf{Solution} & \multicolumn{3}{c}{\textbf{amount of substance [$\si{\mol}$]} } & \multicolumn{3}{c}{\textbf{mass of substance [$\si{\gram}$]} } &\textbf{Volume of Stock [$\si{\milli\liter}$]} \\
\cmidrule(lr){2-4} \cmidrule(lr){5-7}
& $\ce{KH2PO4}$ & $\ce{Na2HPO4}$ & $\ce{NaCl}$ & $\ce{KH2PO4}$ & $\ce{Na2HPO4}$ & $\ce{NaCl}$\\
\midrule
A \\
\bottomrule
\end{tabularx}
\endtabularx
\end{table}
\end{document}
\ce{...}
macros in math mode. Also,left=2cm,top=2cm,right=2cm, bottom=2cm
can be expressed more succinctly asmargin=2cm
.