• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

average of 5 years

yaelcohen

Member
Hello

I am asking for help,

I need to calculate the average for each firm-year, while the avearge is the last 5 profit that each firm has. If there is not 5 years of data please do not calculate it.

I tried to calculate by myself but with wrong answer

Pls advice
 

Attachments

  • Copy of Question 30.xlsb
    9.1 KB · Views: 15
Dear Yaelcohen

This array formula works

=IF(AND(SUM(1*($C$3:$C$35=$C3)*($D$3:$D$35<=$D3))>=5),SUMPRODUCT($E$3:$E$35,($C$3:$C$35=$C3)*($D$3:$D$35*($C$3:$C$35=$C3)>=LARGE($D$3:$D$35*($C$3:$C$35=$C3)*($D$3:$D$35<=$D3),5)),1*($D$3:$D$35<=$D3))/5,"")
 
Back
Top