平均真实范围 - Google表格

时间:2017-08-01 18:02:52

标签: google-sheets google-sheets-query

我从Google Doc帮助论坛复制了以下公式,介绍了如何使用Google表格计算ATR。该公式适用于低于20的天数,对于高于20的天数,它会返回以下错误:

  

功能ARRAY_ROW参数2的行大小不匹配。预期:22。实际:21。

你可以通过修复错误来帮助我。 交易吸引我进入谷歌床单和excel,现在下面超出了我的技能,我仍在使用IF语句。

链接到论坛:https://productforums.google.com/forum/#!topic/docs/gENldwEI040;context-place=forum/docs

$ B1 - 自动收报机

40 - 期间(天)

=average(ARRAYFORMULA(query(query(transpose(abs(query({query({Googlefinance($B1,"High",today(),today()-(40)),Googlefinance($B1,"low",today(),today()-(40+6))},"select Col1,Col2,Col4 order by Col1 desc limit "&40&" "),query(Googlefinance($B1,"close",today(),today()- (40+6)),"select Col2 order by Col1 desc limit "&40&" offset 1 label Col2 'closeyest' ")}, "select Col2-Col3, Col2-Col4, Col3-Col4"))), "select max(Col"&join(",max(Col",row(indirect("A1:A"&40))&")")))))

1 个答案:

答案 0 :(得分:0)

这是有效的

=average(ARRAYFORMULA(query(query(transpose(abs(query({query({Googlefinance($B1,"High",today()-(100),today()),
Googlefinance($B1,"low",today()-(100),today())},
"select Col1,Col2,Col4 order by Col1 desc limit "&40&" "), query(Googlefinance($B1,"close",today()-(100),today()),
"select Col2 order by Col1 desc limit "&40&" offset 1 label Col2 'closeyest' ")}, 
"select Col2-Col3, Col2-Col4, Col3-Col4"))), 
"select max(Col"&join(",
max(Col",row(indirect("A1:A"&40))&")")))))