We consider in this paper the mean-variance formulation in multi-period portfolio selection under no-shorting constraint. Recognizing the structure of a piecewise quadratic value function, we prove that the optimal portfolio policy is piecewise linear with respect to the current wealth level, and derive the semi-analytical expression of the piecewise quadratic value function. One prominent feature of our findings is the identification of a deterministic time-varying threshold for the wealth process and its implications for market settings. We also generalize our results in the mean-variance formulation to utility maximization under no-shorting constraint.