This paper is devoted to discussing the existence and uniqueness of weak solutions to time-fractional elliptic equations having time-dependent variable coefficients. To obtain the main result, our strategy is to combine the Galerkin method, a basic inequality for the fractional derivative of convex Lyapunov candidate functions, the Yoshida approximation sequence and the weak compactness argument.