简体   繁体   English

向下迭代Excel公式单元格范围24

[英]Iterate Excel Formula Cell Ranges down 24

I have an excel sheet with 4 columns: Hour, Date, Prediction, and Actual. 我有一个带有4列的Excel工作表:小时,日期,预测和实际。 I'm trying to first find the Hour that corresponds to the highest aActual value for the day. 我试图首先找到对应于当天最高aActual值的Hour。 I have done this through: 我已经通过以下方式做到了:

=MATCH(MAX(D2:D25),D2:D25,0)

Next I'm trying to find the Hour that corresponds to the highest Prediction value for the day, as well as the hours that correspond to the second, third, fourth, and fifth highest hours of the day. 接下来,我试图找到与当天最高预测值相对应的小时,以及与一天中第二,第三,第四和第五高小时相对应的小时。 I have done the first step through: 我已经完成了第一步:

=MATCH(MAX(C2:C25),C2:C25,0)

As and the second/third/fourth/fifth steps through (example is for second step): 作为第二和第三/第四/第五步(例如第二步):

=MATCH(LARGE(C2:C25,2),C2:C25,0)

My problem is that I want to repeat this for every day on my dataset range, which would require iterating/shifting the ranges downwards in the formula by 24, and I'm not quite sure how to accomplish this. 我的问题是我想在我的数据集范围内每天重复一次,这将需要将公式中的范围向下迭代/下移24,而我不太确定如何完成此操作。 I've tried just using addition to the cell values but that didn't work (needless to say I'm not the best with excel). 我试过只使用除单元格值之外的值,但这没有用(不用说我不是excel最好的)。 Any help is appreciated! 任何帮助表示赞赏! I've attached a screenshot of my spreadsheet for reference. 我已附上我的电子表格的屏幕快照,以供参考。

在此处输入图片说明

You should take advantage of the INDIRECT() formula to chose the range. 您应该利用INDIRECT()公式来选择范围。 Replace your formulas for the following for the first day and then copy them down: 在第一天将您的公式替换为以下内容,然后将其复制下来:

=MATCH(MAX(INDIRECT("D"&(row(a1)-1)*24+2&":D"&row(a1)*24+1)),INDIRECT("D"&(row(a1)-1)*24+2&":D"&row(a1)*24+1),0)

=MATCH(MAX(INDIRECT("C"&(row(a1)-1)*24+2&":C"&row(a1)*24+1)),INDIRECT("C"&(row(a1)-1)*24+2&":C"&row(a1)*24+1),0)

=MATCH(LARGE(INDIRECT("C"&(row(a1)-1)*24+2&":C"&row(a1)*24+1),2),INDIRECT("C"&(row(a1)-1)*24+2&":C"&row(a1)*24+1),0)

As an example, for Day 3, C50:C73 is created the following way (3rd row): 例如,对于第3天,将以以下方式创建C50:C73(第3行):

INDIRECT("C"&(row(a3)-1)*24+2&":C"&row(a3)*24+1)

Reference Row(a3) is = 3, then: 参考行(a3)= 3,则:

INDIRECT("C"&(3-1)*24+2&":C"&3*24+1)
INDIRECT("C"&50&":C"&73)
INDIRECT("C50:C73")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM