Cellular manufacturing is considered as a lean technique of producing similar parts using sells or groups of team members, workstations, or equipment to facilitate operations by removing setup and unnecessary cost components among various operations. Cell formation and layout planning are the most components of the cellular manufacturing. This paper presents a dynamic method to minimize different costs including the total cost of movements within and between cells and exceptional parts. In this study, the Hierarchical Genetic Algorithm (HGA) is used for solving the resulted model and the results are compared with genetic algorithm. The results have indicated that the proposed method could reach optimal solutions for some small and medium sized problems in reasonable amount of time.