brutusmc99
Board Regular
- Joined
- Oct 6, 2014
- Messages
- 113
Given the following table of NBA players who can play 2 different positions (a "-" indicates they only play 1 position:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Pos 1[/TD]
[TD]Pos 2[/TD]
[TD]Player[/TD]
[/TR]
[TR]
[TD]PG[/TD]
[TD]-[/TD]
[TD]Westbrook[/TD]
[/TR]
[TR]
[TD]PF[/TD]
[TD]C[/TD]
[TD]Aldridge[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]PF[/TD]
[TD]Cousins[/TD]
[/TR]
[TR]
[TD]PF[/TD]
[TD]C[/TD]
[TD]Love[/TD]
[/TR]
[TR]
[TD]SF[/TD]
[TD]PF[/TD]
[TD]Anthony[/TD]
[/TR]
[TR]
[TD]SG[/TD]
[TD]SF[/TD]
[TD]Harden[/TD]
[/TR]
[TR]
[TD]PG[/TD]
[TD]-[/TD]
[TD]Lowry[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]PF[/TD]
[TD]Bosh[/TD]
[/TR]
[TR]
[TD]SF[/TD]
[TD]SG[/TD]
[TD]Leonard[/TD]
[/TR]
</tbody>[/TABLE]
I want to be able to look through both Position columns, Pos 1 & Pos 2, and output and sort the player names into a second table as follows:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Position[/TD]
[TD]Player 1[/TD]
[TD]Player 2[/TD]
[TD]Player 3[/TD]
[TD]Player 4[/TD]
[TD]Player 5[/TD]
[/TR]
[TR]
[TD]PG[/TD]
[TD]Westbrook[/TD]
[TD]Lowry[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]SG[/TD]
[TD]Harden[/TD]
[TD]Leonard[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]SF[/TD]
[TD]Anthony[/TD]
[TD]Harden[/TD]
[TD]Leonard[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]PF[/TD]
[TD]Aldridge[/TD]
[TD]Cousins[/TD]
[TD]Love[/TD]
[TD]Anthony[/TD]
[TD]Bosh[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]Aldridge[/TD]
[TD]Cousins[/TD]
[TD]Love[/TD]
[TD]Bosh[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
So, the first player, Westbrook, is only a point guard, so he gets listed only under PG. But the second player, Aldridge, can play both power forward and center, so he is listed under both PF & C. And on down the list.
I can do it okay if I use only one position, i.e., Pos 2 (column B), using the following array formula:
{=INDEX($B$2:$C$11,SMALL(IF($B$2:$B$11=$S2,ROW($B$2:$B$11)-1),COLUMNS($T2:T2)),2)}
But, how can I use both positions (columns A and B)? Am I on the right track or do I need a new approach? Any help would be appreciated, thanks a lot.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Pos 1[/TD]
[TD]Pos 2[/TD]
[TD]Player[/TD]
[/TR]
[TR]
[TD]PG[/TD]
[TD]-[/TD]
[TD]Westbrook[/TD]
[/TR]
[TR]
[TD]PF[/TD]
[TD]C[/TD]
[TD]Aldridge[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]PF[/TD]
[TD]Cousins[/TD]
[/TR]
[TR]
[TD]PF[/TD]
[TD]C[/TD]
[TD]Love[/TD]
[/TR]
[TR]
[TD]SF[/TD]
[TD]PF[/TD]
[TD]Anthony[/TD]
[/TR]
[TR]
[TD]SG[/TD]
[TD]SF[/TD]
[TD]Harden[/TD]
[/TR]
[TR]
[TD]PG[/TD]
[TD]-[/TD]
[TD]Lowry[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]PF[/TD]
[TD]Bosh[/TD]
[/TR]
[TR]
[TD]SF[/TD]
[TD]SG[/TD]
[TD]Leonard[/TD]
[/TR]
</tbody>[/TABLE]
I want to be able to look through both Position columns, Pos 1 & Pos 2, and output and sort the player names into a second table as follows:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Position[/TD]
[TD]Player 1[/TD]
[TD]Player 2[/TD]
[TD]Player 3[/TD]
[TD]Player 4[/TD]
[TD]Player 5[/TD]
[/TR]
[TR]
[TD]PG[/TD]
[TD]Westbrook[/TD]
[TD]Lowry[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]SG[/TD]
[TD]Harden[/TD]
[TD]Leonard[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]SF[/TD]
[TD]Anthony[/TD]
[TD]Harden[/TD]
[TD]Leonard[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]PF[/TD]
[TD]Aldridge[/TD]
[TD]Cousins[/TD]
[TD]Love[/TD]
[TD]Anthony[/TD]
[TD]Bosh[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]Aldridge[/TD]
[TD]Cousins[/TD]
[TD]Love[/TD]
[TD]Bosh[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
So, the first player, Westbrook, is only a point guard, so he gets listed only under PG. But the second player, Aldridge, can play both power forward and center, so he is listed under both PF & C. And on down the list.
I can do it okay if I use only one position, i.e., Pos 2 (column B), using the following array formula:
{=INDEX($B$2:$C$11,SMALL(IF($B$2:$B$11=$S2,ROW($B$2:$B$11)-1),COLUMNS($T2:T2)),2)}
But, how can I use both positions (columns A and B)? Am I on the right track or do I need a new approach? Any help would be appreciated, thanks a lot.