简体   繁体   中英

Excel - Calculate average across months, starting from month in cell reference

I have a sheet where each row is one user, column O shows the date the user record was created, columns R to AE show the number of logins each user has per month, June 2017 to July 2018.

The goal is to only calculate an average of logins for months >= the month the user was created. If the user has a Created On date value less than 1 June 2017, average all the monthly columns R to AE.

Example 1: A user was created on 24 November 2017, therefore I only want to average logins of the month columns from November 2017 onwards.

Example 2: A user was created August 2013, therefore I want to average all month columns (June 2017 to July 2018, R to AE).

I tried using Index Match, though can't figure out how to select the range.

Link to file

Use =SUM(R2:AE) to add the logins to get total login.

Use =DATEDIF(A2, "July 2018", "M") to get the number of months. First argument of DATEDIF is initial date, second argument is final date and "M" signifies that we want number of months as the output

Divide the total login by number of months to get the average.

link to google sheet file

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