首页 > 解决方案 > 查询并转置一长行数据 Google Sheets

问题描述

我有很多列的数据行,例如:

Date=Team2:Date Date Exercise 1 Reps Weight Team Exercise 2 Reps Weight

9/18/2019        9/18/2019   chinup       10        2       2    situp         10     3 

我想将数据拉到另一张表中,如下所示:

Date=Team2:Date    Exercises    Reps    Weight   Team
   9/18/2019       chinup       10      2        2

   9/18/2019       situp        10      3        2

我尝试了查询和转置的组合,但没有得到我想要的结果。这可能吗?

标签: google-sheetsgoogle-sheets-formulaarray-formulasgoogle-sheets-query

解决方案


如果 AddTraining 表是这样的:

0

那么你可以使用:

=ARRAYFORMULA(QUERY({
 AddTraining!A2:A, AddTraining!C2:E; 
 AddTraining!A2:A, AddTraining!G2:I; 
 AddTraining!A2:A, AddTraining!J2:L; 
 AddTraining!A2:A, AddTraining!N2:P; 
 AddTraining!A2:A, AddTraining!R2:T; 
 AddTraining!A2:A, AddTraining!U2:W; 
 AddTraining!A2:A, AddTraining!X2:Z; 
 AddTraining!A2:A, AddTraining!AA2:AC}, 
 "where Col2 is not null
  order by Col1", 0))

0


电子表格演示


推荐阅读