有没有自动的方法来标准化Google工作表数据

时间:2019-04-22 15:42:57

标签: database google-sheets database-normalization google-sheets-formula

我有一个超过3000行的数据集,并且我有一些这种格式的列
(A / B / C)==表(1) 我想用特定的ID ==表(2)标准化每一行:

0

3 个答案:

答案 0 :(得分:0)

=ARRAYFORMULA(QUERY(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
 IF(LEN(X2:X), "♠"&X2:X&"♦"&Y2:Y&"♦"&SPLIT(Z2:Z, "/"), )), , 999^99)), , 999^99), 
 "♠")), "♦")), "where Col3 !=''"))

0

答案 1 :(得分:0)

={X1:Y1, "ID_RF", Z1; 
 ARRAYFORMULA(QUERY({QUERY(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
 IF(LEN(X2:X), "♠"&X2:X&"♦"&Y2:Y&"♦"&SPLIT(Z2:Z, "/"), )), , 999^99)), , 999^99), 
 "♠")), "♦")), "where Col3 !=''"), TRANSPOSE(SPLIT(JOIN(",", REPT(SPLIT(
 QUERY(QUERY(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
 IF(LEN(X2:X), "♠"&X2:X&"♦"&Y2:Y&"♦"&SPLIT(Z2:Z, "/"), )), , 999^99)), , 999^99), 
 "♠")), "♦")), "where Col3 !=''"), 
 "select Col2,count(Col2) where Col2 is not null group by Col2 label count(Col2)''"), 
 ",")&",", QUERY(QUERY(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
 IF(LEN(X2:X), "♠"&X2:X&"♦"&Y2:Y&"♦"&SPLIT(Z2:Z, "/"), )), , 999^99)), , 999^99), 
 "♠")), "♦")), "where Col3 !=''"), 
 "select count(Col2) where Col2 is not null group by Col2 label count(Col2)''"))), 
 ","))&COUNTIFS(QUERY(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
 IF(LEN(X2:X), "♠"&X2:X&"♦"&Y2:Y&"♦"&SPLIT(Z2:Z, "/"), )), , 999^99)), , 999^99), 
 "♠")), "♦")), "select Col2 where Col3 !=''"), 
 QUERY(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
 IF(LEN(X2:X), "♠"&X2:X&"♦"&Y2:Y&"♦"&SPLIT(Z2:Z, "/"), )), , 999^99)), , 999^99), 
 "♠")), "♦")), "select Col2 where Col3 !=''"), ROW(INDIRECT("A1:A"&
 COUNTA(QUERY(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
 IF(LEN(X2:X), "♠"&X2:X&"♦"&Y2:Y&"♦"&SPLIT(Z2:Z, "/"), )), , 999^99)), , 999^99), 
 "♠")), "♦")), "select Col2 where Col3 !=''")))), "<="&ROW(INDIRECT("A1:A"&COUNTA(
 QUERY(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
 IF(LEN(X2:X), "♠"&X2:X&"♦"&Y2:Y&"♦"&SPLIT(Z2:Z, "/"), )), , 999^99)), , 999^99), 
 "♠")), "♦")), "select Col2 where Col3 !=''")))))}, "select Col1,Col2,Col4,Col3"))}

0

答案 2 :(得分:-1)

我有类似如下的要求。

https://i.stack.imgur.com/rEqLN.png

需要从colD中拆分数据,以下是已使用的公式。

=ARRAYFORMULA(QUERY(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE( IF(LEN(C5:C), "♠"&C5:C&"♦"&SPLIT(D5:D, ","), )), , 999^99)), , 999^99), "♠")), "♦")), "where Col2 !=''"))