I really appreciate your help. The formula is working for Group A for first entry but not for the second entry. One of the criteria that it also need to meet is the column 'E' in sheet S_Data for Active and Inactive. It should only picking out the data that meet the group A and Active criteria. I think a small tweeking may solve this issue. If you can sort this out for me too please. Thanks.