I am looking for a more efficient method of determining the last status within an order that is not "OK". The file being referenced has 500,000+ records and the current solution is not viable due to slow processing.
Current solution
{=INDEX(D:D,MAX(IF(A:A=A2,IF(D:D<>"OK",ROW(A:A),""),"")))}
Example code would result in Order A's last status of Expired and Order B's last status of Clearance.
Once the last status is calculated I can be more specific in my need which is needing to know if the last status of an item is Expired.
Current solution
{=INDEX(D:D,MAX(IF(A:A=A2,IF(D:D<>"OK",ROW(A:A),""),"")))}
Code:
Order Item # Product Status
A 1 Corn OK
A 2 Beans OK
A 5 Rice CLEARANCE
A 6 Celery OK
A 10 Carrots EXPIRED
A 11 Cereal OK
B 1 Corn OK
B 2 Beans OK
B 5 Rice EXPIRED
B 6 Celery OK
B 10 Carrots CLEARANCE
B 11 Cereal OK
Example code would result in Order A's last status of Expired and Order B's last status of Clearance.
Once the last status is calculated I can be more specific in my need which is needing to know if the last status of an item is Expired.