I want to compare the value of a cell with all the cells before it and the range of previous cells depends on a condition.
For example, in the below image, I have two people Adam and James. I want to compare B2 with B1, then B3 with both B1 and B2 and so on. But when it comes to James, I want to compare B9 with B8, B10 with B8 and B9 but not with B1-B7, as they belong to Adam.
I've got the previous cell comparison logic working but not the Name condition (formula in column D). How can I do that?
Expected result: