jeffreyweir
Active Member
Formula Challenge 018– Conditional Unique Nth or next smallest value
Challenge description
In our last challenge, we wrote a formula to display the nth largest unique number from the Data column for items in the Item column that matched the currently selected Lookup Item.
But if N was say 6, but we only had 3 unique items, then all these formulas returned Zero.
So your challenge is to amend those approaches so that in those instances, the next smallest non-zero unique value is returned.
Ready? Go!
Challenge setup
Put the following data in A1:B13
[pre]
[/pre]
Assign the name 'n' to the range D2
Assign the name 'l' to the E2
If successful, your formula results will match the below table:
Item N = 1 N = 2 N = 3 N = 4 N = 5
Cat 662100 11287 9439 3090 3090
Apple 662100 9439 3090 3090 3090[/code][/pre]
Rules
* No whole column references
* No intermediate formulas
* No VBA
* No biting, hitting, scratching, or eye gouging. I want a good clean fight, people.
* The formula should work no matter where the source data is shifted in the worksheet. So no hard-coded references other than the named ranges i,d,n, and l
My formula length: 94 characters.
Challenge description
In our last challenge, we wrote a formula to display the nth largest unique number from the Data column for items in the Item column that matched the currently selected Lookup Item.
But if N was say 6, but we only had 3 unique items, then all these formulas returned Zero.
So your challenge is to amend those approaches so that in those instances, the next smallest non-zero unique value is returned.
Ready? Go!
Challenge setup
Put the following data in A1:B13
[pre]
Code:
Item (i) Data (d)
Cat 662100
Cat 11287
Cat 11287
Apple 9439
Apple 3090
Cat 3090
Apple 662100
Cat 11287
Cat 11287
Cat 9439
Apple 3090
Cat 3090
Assign the name 'i' to the Item list
Assign the name 'd' to the Data list
Those ranges can include or exclude the header rows as you see fit.
Put the following data in D1:E2
[pre][code]Nbr(n): Lookup(l):
3 Cat
Assign the name 'n' to the range D2
Assign the name 'l' to the E2
If successful, your formula results will match the below table:
Item N = 1 N = 2 N = 3 N = 4 N = 5
Cat 662100 11287 9439 3090 3090
Apple 662100 9439 3090 3090 3090[/code][/pre]
Rules
* No whole column references
* No intermediate formulas
* No VBA
* No biting, hitting, scratching, or eye gouging. I want a good clean fight, people.
* The formula should work no matter where the source data is shifted in the worksheet. So no hard-coded references other than the named ranges i,d,n, and l
My formula length: 94 characters.