0
votes

I have the follow columns.

A.            B
1 Events
2 Exit
3 Load
4 Charge
5 Charge
6 Arrive
7 Unload
8 Load
9 Exit.         
 

In B9 I have the formula:

=IF(A9="Exit",ARRAYFORMULA(INDEX($A$2:$A8,MATCH(2,1/(SEARCH({"Arrive","Load"},$A$2:$A8))))),"")   

I'm trying to find out the first match, in this case "Load" from A8 to A2, but it returns only the first name in the formula "Arrive", ignoring the second option of search "Load" which is the first match in the range.

Some idea about how can I perform this?

1

1 Answers

0
votes

I found a solution. =IF(A9="Exit",ARRAYFORMULA(INDEX($A$2:$A8,IF(MATCH(2,1/(SEARCH("Arrive",$A$2:$A8))))>MATCH(2,1/(SEARCH("Load",$A$2:$A8)))),MATCH(2,1/(SEARCH("Arrive",$A$2:$A8)))),MATCH(2,1/(SEARCH("Load",$A$2:$A8)))))),"")

That s a little complex. If somebody know a simple way to perform that, please feel free to help us.