No array formula needed:
MINIFS($A$2:$A$7,$B$2:$B$7,D$1,$A$2:$A$7,">" & MAX(D$1:D1))
Just a simple MINIFS. Then wrap it in an IF to remove the zeros:
EDIT: Further clarification in response to comment.
I have put both tables on the same sheet for ease, however, one could easily be moved onto a separate sheet if needed.
The formula works by selecting the group with the lowest value, which has the name which appears at the top of the column AND which has not already been listed.
So:
MINIFS($A$2:$A$7,$B$2:$B$7,D$1,$A$2:$A$7,">" & MAX(D$1:D1))
The first argument in the MINIFS formula is $A$2:$A$7
. This is the column containing all the groups, which we want to split out and list against each name.
The 2nd and 3rd argument ($B$2:$B$7,D$1
) is a criteria range and it's value. This is used to filter out any name we dont want to return in this particular cell (any that are not "Barney" in the case of D2). Notice that the D$1
in the formula does not start with a $
, this means that we can just drag the formula across the other name columns and it will filter out the correct names automatically.
The 4th and 5th Arguments ($A$2:$A$7,">" & MAX(D$1:D1)
) are also a criteria range and its value. Howevever, in the case of the value this time, we are looking for the max value within a range. We are looking at all the groups which have already been listed against a name and using MAX to select the highest one.Notice that there is a $
before the first "1" in the formula but not before the second. This means that as we drag the formula down, the range that it is looking for the MAX in, will automatically expand to include the cell just above the current one. Also note that there is no $
before either of the "D"s, this is so that when you drag the formula to the right, the range it is checking also moves to the right. Once we have the MAX group which has already been listed against a name, we tell the MINIFS formula to only look at groups which are greater than that.
Once there are no groups for a name which are greater than the previously listed group, the MINIFS formula will return 0. To prevent the table from showing lot's of 0's, we simply say "If the MINIFS formula returns 0, then return an empty string instead:
=IF(<the result of the MINIFS>=0, "",<the result of the MINIFS>)
So the final formula would be:
=IF(MINIFS($A$2:$A$7,$B$2:$B$7,D$1,$A$2:$A$7,">" & MAX(D$1:D1))=0,"",MINIFS($A$2:$A$7,$B$2:$B$7,D$1,$A$2:$A$7,">" & MAX(D$1:D1)))
I hope that makes more sense for you. I am sorry if the explanation is a bit long winded, but as you didn't give me a specific area that you didn't understand, I just tried to expand my explanation generally. If there is any specific part you need me to explain further, please let me know.