This is a kind of an extension to this problem: Excel - Sum values from the data set based on criteria
I have a table like this:
Country Region Code Name of product Year Value
Sweden Stockholm 52 Apple 1995 1000
Sweden Malmö 25 Pancake 1991 1500
Sweden Malmö 52 Apple 1992 2470
Finland Helsinki 21 Candy 1987 2500
Denmark Copenhagen 52 Apple 1987 2571
What I want to do is to make a code that can give me the sum of the nth largest value of products that have been sold in a specific country.
That is, if I want to get the highest value
for products
sold in Sweden
it should return Apple
and the sum of sold apples, 3470
.
edit: The solution of Glitch_Doctor: