Google Sheet - How to FULL OUTER JOIN with one table?

馋奶兔 提交于 2021-01-29 19:51:05

问题


I would like to create a tables for my tournament. I create a table with some players and their leagues.

Players

I would like to generate matchmaking table, by league, like that

Matchmaking table generated

I'm to weak with google spreadsheet to do that. I understood I can't use "JOIN" with "QUERY()" function. It seems I need to use "ArrayFormula()" and "VLOOKUP()" functions but after hours pasted to try, I failed.

If anyone of you can help me, it will be so great !

Here is a googlesheet with datas : https://docs.google.com/spreadsheets/d/19ThnwVme8f3Ee730w8lTAyEJE9YdxzLEfox8arl5Q4o/edit?usp=sharing

Thanks a lot, I hope my problem is clear :)

Edit : Seems we are limited by number of characters in REPT() function. If there is an other solution than the answer or a "workaround", feel free to share it :)


回答1:


try:

=ARRAYFORMULA(UNIQUE(QUERY(SPLIT(IF(
 FLATTEN(SPLIT(REPT(CONCATENATE(IF(A3:A="";;A3:A&"♠"&B3:B&"♠"&C3:C)&"♦"); COUNTA(A3:A)); "♦"))<
 FLATTEN(SPLIT(CONCATENATE(REPT(IF(A3:A="";;A3:A&"♠"&B3:B&"♠"&C3:C)&"♦"; COUNTA(A3:A))); "♦")); 
 FLATTEN(SPLIT(REPT(CONCATENATE(IF(A3:A="";;A3:A&"♠"&B3:B&"♠"&C3:C)&"♦"); COUNTA(A3:A)); "♦"))&"♠"&
 FLATTEN(SPLIT(CONCATENATE(REPT(IF(A3:A="";;A3:A&"♠"&B3:B&"♠"&C3:C)&"♦"; COUNTA(A3:A))); "♦"));
 FLATTEN(SPLIT(CONCATENATE(REPT(IF(A3:A="";;A3:A&"♠"&B3:B&"♠"&C3:C)&"♦"; COUNTA(A3:A))); "♦"))&"♠"&
 FLATTEN(SPLIT(REPT(CONCATENATE(IF(A3:A="";;A3:A&"♠"&B3:B&"♠"&C3:C)&"♦"); COUNTA(A3:A)); "♦"))); "♠"); 
 "select Col1,Col2,Col4,Col5,Col6
  where Col1 <> Col4 
    and Col3 =  Col6")))




回答2:


unlimited:

=INDEX(QUERY(SPLIT(FLATTEN(IF(
 ROW(INDIRECT("A1:A"&COUNTA(A3:A)))<=TRANSPOSE(
 ROW(INDIRECT("A1:A"&COUNTA(A3:A))));;
 FILTER(A3:A&"♦"&B3:B&"♦"&C3:C; A3:A<>"")&"♦"&TRANSPOSE(
 FILTER(A3:A&"♦"&B3:B&"♦"&C3:C; A3:A<>"")))); "♦"); 
 "select Col4,Col5,Col1,Col2,Col6
  where Col2 is not null 
    and Col3 =  Col6
  order by Col4"; 0))



来源:https://stackoverflow.com/questions/65600837/google-sheet-how-to-full-outer-join-with-one-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!