I’ve got a table with three columns: the first column (column A) shows bus service numbers, the second (column B) indicates the route direction (circular, inward, outward) and the third column (column C) the respective mileage. I would like to add the mileage for matching inward and outward services so I know how long the return journey would be (the routes can be slightly different due to one-way streets for example). Here is a short example (my table contains a lot more services):

number direction mileage
3A Circular 3.18
5E Inward 9.47
5E Outward 9.43
5EB Outward 9.21
6A Circular 5.57

I think in a first step I’d need to exclude all circular services by sorting the data, which is no problem. Then I’d have to check if there is a matching pair in column A. Then, if there is such a pair I’d need to check if one of them is an inward and the other one an outward journey in column B. If this is the case too, I’d like to add up their individual mileages.

Any help on all steps would be greatly appreciated.

For the first step I tried MATCH but because the cell’s value is within the range I am comparing it to, the result is always true (e.g. MATCH(A3,A$1:A$5,0)) and of course MATCH only returns the position of the matched value but I suppose I could overcome the latter by using an IF function and turning any number into TRUE?

For the other steps I don’t have any ideas at all.

Maybe I am trying to achieve something that isn’t possible but I don’t hope so!

Many thanks for your help!
Chris