Would a pivot table not be an easier solution?