This research derived an optimal solution of dynamic portfolio and consumption problems under utility functions that depend on both consumption and habit formation. This paper also showed features of the optimal solution through some numerical simulations.