try:
=ARRAYFORMULA(IFNA(VLOOKUP(E2:E&"?"&F2:F;
REGEXREPLACE(TRIM(SPLIT(FLATTEN(QUERY(TRANSPOSE(QUERY(QUERY(TRIM(SPLIT(
FLATTEN(IF(IFERROR(SPLIT(USERS!B2:B; ","))="";;
SPLIT(USERS!B2:B; ",")&"?"&USERS!C2:C&"??"&USERS!A2:A&",?"&USERS!A2:A)); "?"));
"select Col1,max(Col2) where Col2 is not null group by Col1 pivot Col3");
"offset 1"; 0));;9^9)); "?")); ",$"; ); 2; 0)))
update:
=ARRAYFORMULA(QUERY({USERS!A:C, TRIM(FLATTEN(QUERY(TRANSPOSE(
IF(IFERROR(SPLIT(USERS!B:B, ","))="",,
SPLIT(USERS!B:B, ",")&"?"&USERS!C:C)),,9^9)))},
"select Col1,Col2,Col3 where Col4 matches '.*"&TEXTJOIN(".*|.*", 1,
IF(LOCATIONS!A2:A="",,LOCATIONS!A2:A&"?"&LOCATIONS!B2:B))&".*'", 1))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…