将列转换为对角线

时间:2017-04-03 18:28:01

标签: google-sheets

我觉得我在问GSheets中的公式是不可能的,但我对这个论坛已经能够回答的事情感到惊讶,所以我试了一下。 :)

我每天早上都会收到一份报告,显示X天的入住率。它可以导出为csv文件,百分比在列中。我制作了一个电子表格,我们手动将此列作为对角线放置,以反映相应日期的占用情况。我已经链接到了这个样本。我已将“数据”中的3月31日数据放入,因为我希望看到它显示在“sheet1”上。

任何方法都可以从'数据'中获取数据以自动转置或显示在工作表1上?它还需要为每个填充的日期列(数据)向下移动日期行(sheet1)。

我希望我能清楚地解释这一点。如果我需要澄清,请告诉我。

谢谢!

https://docs.google.com/spreadsheets/d/1-PQ1GXRmsXrd7u9SHBT-gZkSYE6oLKkMttndmULEomY/edit?usp=sharing

1 个答案:

答案 0 :(得分:0)

您可以将其放入C2并拖动到该顶行。:

=ARRAYFORMULA(IFERROR(Data!$B$2:$B$29/IF((COLUMN()-1=ROW(Data!$B$2:$B$29)),1,0),""))

enter image description here

如果您坚持使用单个单元格数组公式,那么这将起作用:

=ARRAYFORMULA( {IFERROR(Data!$B$2:$B$29/IF((2=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((3=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((4=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((5=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((6=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((7=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((8=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((9=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((10=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((11=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((12=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((13=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((14=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((15=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((16=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((17=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((18=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((19=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((20=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((21=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((22=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((23=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((24=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((25=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((26=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((27=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((28=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((29=ROW(Data!$B$2:$B$29)),1,0),"")})

enter image description here

您必须删除数组公式中要填充的所有单元格才能使其正常工作(C2:AD29)。