A subgroup $H$ is called a weak second maximal subgroup of $G$ if $H$ is a maximal subgroup of a maximal subgroup of $G$. Let $m(G,H)$ denote the number of maximal subgroups of $G$ containing $H$. We prove that $m(G,H)-1$ divides the index of some maximal subgroup of $G$ when $H$ is a weak second maximal subgroup of $G$. This partially answers a question of Flavell [‘Overgroups of second maximal subgroups’, Arch. Math.64(4) (1995), 277–282] and extends a result of Pálfy and Pudlák [‘Congruence lattices of finite algebras and intervals in subgroup lattices of finite groups’, Algebra Universalis11(1) (1980), 22–27].