简体   繁体   中英

How to lookup a row to calculate a simple average?

Here is my spreadsheet: http://i.imgur.com/ehLztNt.jpg

I need to calculate the average of a range of cells. This is for cell E5.

The beginning of the range is given by week start : So the start of the range is cell B2 (because it's the only row with week start as it's date ).

The end of the range is simply the weight of row 4.

In this particular case output would be identical as: AVERAGE(B2:B4)

Instead of saying directly B2 , I want to say: 'The weight in the row that starts with week start '

I should then be able to auto fill this formula to the rest of the spreadsheet.

In this sense, week start is a kind of key that tells me where the average starts.

How can I do this?

您可以只使用AVERAGEIFS()吗?

=AVERAGEIFS(B:B,A:A,">="&J5,A:A,"<"&A5)

在E5中使用此功能,然后复制/拖动。

=AVERAGE(INDEX(B:B,MATCH(J5,A:A,0)):B4)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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