简体   繁体   中英

Averaging a set range of cell values based on a separate cell value

Trying to return an average based on a finite set of values in a range. The range starting point is determined by a separate cell value.

If Cell A1 = 3/1/15 I need the average of values beginning with 3/1/15 column, and extending 12 columns.

Starting date in A2, Avg in B2, List of Date headers in C1:Z1, cell values underneath headers columns.


https://docs.google.com/spreadsheets/d/1hDPPIWKFUbKiUNvwbbY-6lFp18ujderwgaFSa9OqMEU/edit?usp=sharing

Try using the AVERAGEIFS function, so in cell B2 to calculate the average of cells C2 to Q2 if they are between the value in A2 and 365 days on from the value in A2:

(Adapted using comment from @Scott)

=AVERAGEIFS(C2:Q2,$C$1:$Q$1,">="&A2,$C$1:$Q$1,"<"&A2+365)

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