Excel Process Automation

Hi All, I have one query. There will be specific pattern in sheet1 like {Year\Month} or {yy_mm_dd} in column A.when it will encounter similar patterns it has to move to Sheet3 where values will be assigned to corresponding pattern. I need to process records row by row. Will anyone suggest which is the best approach to implement this. Please find the attachment for reference.

sheet2