NeedInformation
New Member
- Joined
- Feb 23, 2014
- Messages
- 14
- Office Version
- 2021
- Platform
- Windows
Would appreciate help with the following.
I have a large, unsorted table in one worksheet tab and I need to populate a sorted TOP N list on another worksheet tab where TOP is the largest amount of sales (largest being #1 ) but it has to be only with those of a certain color. I need to return the KEY into the TOP N table. KEY is guaranteed to be unique in the source table. From the KEY I can retrieve any additional needed data to populate the target tab. There can be duplicate sales amounts. In fact, anything can be duplicated save for the KEY value.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]KEY[/TD]
[TD]Sales[/TD]
[TD]Color[/TD]
[TD]Name[/TD]
[/TR]
[TR]
[TD]asdf[/TD]
[TD]100[/TD]
[TD]Red[/TD]
[TD]Sam[/TD]
[/TR]
[TR]
[TD]qwer[/TD]
[TD]200[/TD]
[TD]blue[/TD]
[TD]Nick[/TD]
[/TR]
[TR]
[TD]zxcv[/TD]
[TD]100[/TD]
[TD]Red[/TD]
[TD]Mary[/TD]
[/TR]
[TR]
[TD]5463[/TD]
[TD]2000[/TD]
[TD]Green[/TD]
[TD]Sally[/TD]
[/TR]
[TR]
[TD]fghj[/TD]
[TD]150[/TD]
[TD]Red[/TD]
[TD]Mark[/TD]
[/TR]
[TR]
[TD]yuio[/TD]
[TD]300[/TD]
[TD]Yellow[/TD]
[TD]Tom[/TD]
[/TR]
[TR]
[TD]cvbn[/TD]
[TD]275[/TD]
[TD]Blue[/TD]
[TD]Ralph[/TD]
[/TR]
[TR]
[TD]ghjk[/TD]
[TD]500[/TD]
[TD]Red[/TD]
[TD]Sara[/TD]
[/TR]
[TR]
[TD]ghjz[/TD]
[TD]750[/TD]
[TD]Blue[/TD]
[TD]Rita[/TD]
[/TR]
</tbody>[/TABLE]
So, a top 3 list based on Red would return TOP=3, COLOR=RED
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Key[/TD]
[/TR]
[TR]
[TD]ghjk[/TD]
[/TR]
[TR]
[TD]fghj[/TD]
[/TR]
[TR]
[TD]asdf[/TD]
[/TR]
</tbody>[/TABLE]
In the case of duplicate, a top-down selection would be fine as illustrated by the key asdf as opposed to zxcv above.
If SALES has to be part of the solution to help find the key that's okay.
Formulas are the preferred solution vs macro(s).
TIA!
I have a large, unsorted table in one worksheet tab and I need to populate a sorted TOP N list on another worksheet tab where TOP is the largest amount of sales (largest being #1 ) but it has to be only with those of a certain color. I need to return the KEY into the TOP N table. KEY is guaranteed to be unique in the source table. From the KEY I can retrieve any additional needed data to populate the target tab. There can be duplicate sales amounts. In fact, anything can be duplicated save for the KEY value.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]KEY[/TD]
[TD]Sales[/TD]
[TD]Color[/TD]
[TD]Name[/TD]
[/TR]
[TR]
[TD]asdf[/TD]
[TD]100[/TD]
[TD]Red[/TD]
[TD]Sam[/TD]
[/TR]
[TR]
[TD]qwer[/TD]
[TD]200[/TD]
[TD]blue[/TD]
[TD]Nick[/TD]
[/TR]
[TR]
[TD]zxcv[/TD]
[TD]100[/TD]
[TD]Red[/TD]
[TD]Mary[/TD]
[/TR]
[TR]
[TD]5463[/TD]
[TD]2000[/TD]
[TD]Green[/TD]
[TD]Sally[/TD]
[/TR]
[TR]
[TD]fghj[/TD]
[TD]150[/TD]
[TD]Red[/TD]
[TD]Mark[/TD]
[/TR]
[TR]
[TD]yuio[/TD]
[TD]300[/TD]
[TD]Yellow[/TD]
[TD]Tom[/TD]
[/TR]
[TR]
[TD]cvbn[/TD]
[TD]275[/TD]
[TD]Blue[/TD]
[TD]Ralph[/TD]
[/TR]
[TR]
[TD]ghjk[/TD]
[TD]500[/TD]
[TD]Red[/TD]
[TD]Sara[/TD]
[/TR]
[TR]
[TD]ghjz[/TD]
[TD]750[/TD]
[TD]Blue[/TD]
[TD]Rita[/TD]
[/TR]
</tbody>[/TABLE]
So, a top 3 list based on Red would return TOP=3, COLOR=RED
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Key[/TD]
[/TR]
[TR]
[TD]ghjk[/TD]
[/TR]
[TR]
[TD]fghj[/TD]
[/TR]
[TR]
[TD]asdf[/TD]
[/TR]
</tbody>[/TABLE]
In the case of duplicate, a top-down selection would be fine as illustrated by the key asdf as opposed to zxcv above.
If SALES has to be part of the solution to help find the key that's okay.
Formulas are the preferred solution vs macro(s).
TIA!