How do I return different values (Y or N) to different cells (ColD - Master) based upon matching criteria (ColA - Date and ColB - Customer) and sort orders (MasterItemRanking tab ColA) in Google Sheets?
https://docs.google.com/spreadsheets/d/1Yar31N__3jkHH3y6qn_XZ0cvkEg-gG0ALeT0FF8qEQE/edit?usp=sharing
On Sheet "MasterItemRanking" ColA, the lower the value in ColA, the higher the ranking. Ranking of a #1 is superior to a ranking of a #2 or #5, etc (which means ColB item should be returned as "Y" before any of the others).
I have tried various expressions in ColD and have failed miserably so far. Thoughts? Thanks.
This is a complicated answer, but it seems like this formula works. =arrayformula(if(A2="",,iferror(if(C2=vlookup(MIN(if(countA(vlookup(filter(C$2:C$10,A$2:A$10=A2,B$2:B$10=B2),{MasterItemRanking!B:B,MasterItemRanking!A:A},2,false))=1,"N",vlookup(filter(C$2:C$10,A$2:A$10=A2,B$2:B$10=B2),{MasterItemRanking!B:B,MasterItemRanking!A:A},2,false))),MasterItemRanking!A:B,2,false),"Y","N"),"N")))
I put it into your sheet and it seems to make sense, although if there is anything it is missing, let me know. It basically filters the table for just that row's data to see if there are multiple items that have the same date and person. Then it does a vlookup to return for each item its ranking. Then it grabs the min value ranking and checks that value against the item in that row. For example, if it returns ranking one, then it checks that row item to see if it is also ranking #1. It does this for each row. This is a very convoluted answer lol, it is sort of hard to explain this one.