将数据从一张纸格式化为另一张纸

问题描述 投票:0回答:1

我是Google表格的新手,需要帮助从一张表格中获取数据并将其转移到另一张表格中。数据表有两个日期,报告表询问该月遇到了多少次。该报告将需要每天运行一次。

我什至不知道从哪里开始。任何帮助将非常感激!

这里是我创建的样本的链接。原始版本大约有148所学校。https://docs.google.com/spreadsheets/d/1p7C81Y1icWB7Pjvl7ocOVrx4SKmXFsfWkpedbWUVsv0/edit?usp=sharing

google-sheets google-sheets-formula transpose array-formulas google-sheets-query
1个回答
0
投票

粘贴A3

=ARRAYFORMULA({{"School"; SORT(UNIQUE(FILTER(Data!A2:A, Data!A2:A<>"")))}, 
 QUERY(TRANSPOSE(SORT(TRANSPOSE(QUERY(SPLIT(TRANSPOSE(SPLIT(
 QUERY(TRANSPOSE(QUERY(TRANSPOSE(
 IF(Data!B2:Z="",,"♠"&Data!A2:A&"♦"&TEXT(
 FILTER(Data!B2:Z, ISEVEN(COLUMN(Data!B2:Z))), "mm_mmmm")&"♦"&
 FILTER(Data!B2:Z, ISODD( COLUMN(Data!B2:Z))))),,999^99)),,999^99)&
 TEXTJOIN( , 1, "♠×♦"&TEXT({ROW(Data!A1:A5); ROW(Data!A8:A12)}&
 "/01/2020", "mm_mmmm")&"♦99999"), "♠")), "♦"), 
 "select sum(Col3),count(Col3) 
  where Col3 is not null 
    and not Col2 matches '07_July|06_Jun'
  group by Col1 
  pivot Col2")), 1, 0)), 
 "select Col9,Col10,Col7,Col8,Col5,Col6,Col3,Col4,Col1,Col2,Col19,
         Col20,Col17,Col18,Col15,Col16,Col13,Col14,Col11,Col12
  limit "&COUNTUNIQUE(Data!A2:A), 0)})

0

spreadsheet demo


更新:

大规模数据集修复:

=ARRAYFORMULA(QUERY({
 QUERY(TRANSPOSE(SORT(TRANSPOSE(QUERY(SPLIT(TRANSPOSE(SPLIT(
 QUERY(TRANSPOSE(QUERY(TRANSPOSE(
 IF(Data!B2:Z="",,"♠"&Data!A2:A&"♦"&TEXT(
 FILTER(Data!B2:Z, ISEVEN(COLUMN(Data!B2:Z))), "mm_mmmm")&"♦"&
 FILTER(Data!B2:Z, ISODD( COLUMN(Data!B2:Z)))*1)),,999^99)),,999^99)&
 TEXTJOIN( , 1, "♠×♦"&TEXT({ROW(Data!A1:A5); ROW(Data!A8:A12)}&
 "/01/2020", "mm_mmmm")&"♦99999"), "♠")), "♦"),
 "select Col1,sum(Col3),count(Col3) 
  where Col3 is not null 
    and not Col2 matches '06_Jun|07_July'
  group by Col1 
  pivot Col2")), 1, 0)), "select Col21 label Col21'Schools'"), 
 QUERY(TRANSPOSE(SORT(TRANSPOSE(QUERY(SPLIT(TRANSPOSE(SPLIT(
 QUERY(TRANSPOSE(QUERY(TRANSPOSE(
 IF(Data!B2:Z="",,"♠"&Data!A2:A&"♦"&TEXT(
 FILTER(Data!B2:Z, ISEVEN(COLUMN(Data!B2:Z))), "mm_mmmm")&"♦"&
 FILTER(Data!B2:Z, ISODD( COLUMN(Data!B2:Z)))*1)),,999^99)),,999^99)&
 TEXTJOIN( , 1, "♠×♦"&TEXT({ROW(Data!A1:A5); ROW(Data!A8:A12)}&
 "/01/2020", "mm_mmmm")&"♦99999"), "♠")), "♦"),
 "select sum(Col3),count(Col3) 
  where Col3 is not null 
    and not Col2 matches '06_Jun|07_July'
  group by Col1 
  pivot Col2")), 1, 0)),
 "select Col9,Col10,Col7,Col8,Col5,Col6,Col3,Col4,Col1,Col2,Col19,
         Col20,Col17,Col18,Col15,Col16,Col13,Col14,Col11,Col12", 0)}, 
 "where not Col1 = '×'", 0))
© www.soinside.com 2019 - 2024. All rights reserved.