excel - google sheets if string matches and is last matching string in set of cells get value of cell nest to it -


below example of data in table

+--------------+------+---------+    | expense name | cost | mileage |     +--------------+------+---------+    | costco gas   |   20 |  145200 |     | marathon gas |    2 |  145500 |    | oil change   |   35 |  145600 |    | marathon gas |   25 |  145750 |    | a/c work     |  305 |  145800 |    | oil change   |   36 |  150000 |    +--------------+------+---------+   

whenever "expanse name" string equals "oil change" , has highest mileage corresponding mileage want mileage appear in separate column.

so data search through "expense name" column , find 2 matched string. 2 want 1 higher mileage(150000) appear.

another method doesn't require dragging or array formulae is

=max(filter(c2:c, a2:a = "oil change")) 

Comments